Update dapr-shared.yaml #104
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Copyright 2021 The Dapr Authors | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# | |
name: dapr-shared-init | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
permissions: | |
contents: write | |
jobs: | |
build: | |
name: "Build artifacts on ubuntu" | |
runs-on: ubuntu-latest | |
env: | |
GOOS: "${{ matrix.target_os }}" | |
GOARCH: "${{ matrix.target_arch }}" | |
GOPROXY: "https://proxy.golang.org" | |
ARCHIVE_OUTDIR: "dist/archives" | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
with: | |
image: tonistiigi/binfmt:latest | |
platforms: arm64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
version: v0.10.1 # Don't use latest since it broke our workflow once | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
id: setup-go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: "go.mod" | |
- name: Parse release version and set REL_VERSION and LATEST_RELEASE | |
run: python ./.github/scripts/get_release_version.py ${{ github.event_name }} | |
- name: Updates version | |
run: | | |
echo "REL_VERSION=${REL_VERSION}" >>${GITHUB_ENV} | |
echo "BINARIES=daprd" >>${GITHUB_ENV} | |
shell: bash | |
- name: Set REPO_OWNER | |
run: | | |
REPO_OWNER=${{ github.repository_owner }} | |
# Lowercase the value | |
echo "REPO_OWNER=${REPO_OWNER,,}" >>${GITHUB_ENV} | |
mkdir -p ${{ env.ARCHIVE_OUTDIR }} | |
shell: bash | |
- name: Run make release to build and archive binaries | |
run: | | |
make release | |
shell: bash | |
- name: Copy out file from volume | |
run: | | |
sudo cp ./shared-init ${{ env.ARCHIVE_OUTDIR }}/shared-init | |
- name: upload artifacts | |
uses: actions/upload-artifact@master | |
with: | |
name: shared-init | |
path: ${{ env.ARCHIVE_OUTDIR }} | |
publish: | |
name: Publish binaries | |
needs: build | |
if: github.event_name != 'pull_request' | |
env: | |
ARCHIVE_OUTDIR: "dist/archives" | |
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }} | |
ARTIFACT_DIR: ./release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
- name: Parse release version and set REL_VERSION and LATEST_RELEASE | |
run: python ./.github/scripts/get_release_version.py ${{ github.event_name }} | |
- name: Set REPO_OWNER | |
shell: bash | |
run: | | |
REPO_OWNER=${{ github.repository_owner }} | |
# Lowercase the value | |
echo "REPO_OWNER=${REPO_OWNER,,}" >>${GITHUB_ENV} | |
- name: "download artifact: shared-init" | |
uses: actions/download-artifact@master | |
with: | |
name: shared-init | |
path: ${{ env.ARCHIVE_OUTDIR }} | |
- name: generate checksum files | |
run: cd ${{ env.ARCHIVE_OUTDIR }} && for i in *; do sha256sum -b $i > "$i.sha256"; done && cd - | |
- name: publish binaries to github | |
if: startswith(github.ref, 'refs/tags/v') | |
run: | | |
echo "installing github-release-cli..." | |
sudo npm install --silent --no-progress -g [email protected] | |
if [ "$LATEST_RELEASE" = "true" ]; then | |
export RELEASE_BODY=`cat ./docs/release_notes/v${REL_VERSION}.md` | |
else | |
export RELEASE_BODY="This is the release candidate ${REL_VERSION}" | |
fi | |
# Get the list of files | |
RELEASE_ARTIFACT=(${{ env.ARCHIVE_OUTDIR }}/*) | |
# Parse repository to get owner and repo names | |
OWNER_NAME="${GITHUB_REPOSITORY%%/*}" | |
REPO_NAME="${GITHUB_REPOSITORY#*/}" | |
export GITHUB_TOKEN=${{ secrets.DAPR_BOT_TOKEN }} | |
echo "Uploading Dapr-Shared Runtime Binaries to GitHub Release" | |
github-release upload \ | |
--owner $OWNER_NAME \ | |
--repo $REPO_NAME \ | |
--tag "v${REL_VERSION}" \ | |
--release-name "Dapr-Shared Runtime v${REL_VERSION}" \ | |
--body "${RELEASE_BODY}" \ | |
--prerelease true \ | |
${RELEASE_ARTIFACT[*]} | |
shell: bash | |
docker-publish: | |
name: Publish docker images | |
needs: build | |
if: github.event_name != 'pull_request' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
- name: Parse release version and set REL_VERSION and LATEST_RELEASE | |
run: python ./.github/scripts/get_release_version.py ${{ github.event_name }} | |
- name: Set REPO_OWNER | |
shell: bash | |
run: | | |
REPO_OWNER=${{ github.repository_owner }} | |
# Lowercase the value | |
echo "REPO_OWNER=${REPO_OWNER,,}" >>${GITHUB_ENV} | |
- name: Container Registry login | |
uses: docker/login-action@v2 | |
env: | |
DOCKER_REGISTRY_ID: ${{ secrets.DOCKER_DAPRIO_REGISTRY }} | |
with: | |
username: ${{ secrets.DOCKER_REGISTRY_ID }} | |
password: ${{ secrets.DOCKER_REGISTRY_PASS }} | |
- uses: ko-build/[email protected] | |
- name: Build & Push Images | |
env: | |
KO_DOCKER_REPO: ${{ secrets.DOCKER_DAPRIO_REGISTRY }}/dapr-shared | |
run: | | |
ko build cmd/shared-init/main.go --platform=linux/amd64,linux/arm64 --tags ${REL_VERSION} --bare | |
helm: | |
runs-on: ubuntu-latest | |
if: github.event_name != 'pull_request' | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: Parse release version and set REL_VERSION and LATEST_RELEASE | |
run: python ./.github/scripts/get_release_version.py ${{ github.event_name }} | |
- name: setup helm | |
run: | | |
curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null | |
sudo apt-get install apt-transport-https --yes | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list | |
sudo apt-get update | |
sudo apt-get install helm | |
- name: install helm | |
run: helm plugin install https://github.com/quintush/helm-unittest | |
- name: execute unit tests | |
run: helm unittest chart/dapr-shared | |
- name: Update init-container tag | |
run: | | |
sed -i -e "s|tag: latest|tag: ${REL_VERSION}|g" ./chart/dapr-shared/values.yaml | |
cat ./chart/dapr-shared/values.yaml | |
- name: Container Registry login | |
uses: docker/login-action@v2 | |
env: | |
DOCKER_REGISTRY_ID: ${{ secrets.DOCKER_DAPRIO_REGISTRY }} | |
with: | |
username: ${{ secrets.DOCKER_REGISTRY_ID }} | |
password: ${{ secrets.DOCKER_REGISTRY_PASS }} | |
- name: Package & Push Helm Chart | |
run : | | |
helm package \ | |
./chart/dapr-shared \ | |
--version ${REL_VERSION} | |
echo ${{ secrets.DOCKER_REGISTRY_PASS }} | helm registry login registry-1.docker.io -u ${{ secrets.DOCKER_REGISTRY_ID }} --password-stdin | |
helm push dapr-shared-chart-${REL_VERSION}.tgz oci://docker.io/${{ secrets.DOCKER_DAPRIO_REGISTRY }} | |
shell: bash |