fix: use force parameter correctly in create_deploy_key #44
This file contains hidden or 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
| name: Release | |
| on: | |
| push: | |
| branches: | |
| - master | |
| permissions: | |
| contents: write | |
| packages: write | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }}/operator | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.get-version.outputs.version }} | |
| released: ${{ steps.get-version.outputs.released }} | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "lts/*" | |
| - name: Install dependencies | |
| run: | | |
| npm init -y | |
| npm install --save-dev \ | |
| semantic-release \ | |
| @semantic-release/git \ | |
| @semantic-release/changelog \ | |
| @semantic-release/github \ | |
| @semantic-release/exec | |
| - name: Semantic Release | |
| id: semantic | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: npx semantic-release | |
| - name: Get version | |
| id: get-version | |
| run: | | |
| if [ -f .VERSION ]; then | |
| echo "released=true" >> $GITHUB_OUTPUT | |
| echo "version=$(cat .VERSION)" >> $GITHUB_OUTPUT | |
| else | |
| echo "released=false" >> $GITHUB_OUTPUT | |
| echo "version=" >> $GITHUB_OUTPUT | |
| fi | |
| build-and-push: | |
| needs: release | |
| if: needs.release.outputs.released == 'true' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: master | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: | | |
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.release.outputs.version }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| publish-helm: | |
| needs: [release, build-and-push] | |
| if: needs.release.outputs.released == 'true' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: master | |
| - name: Install Helm | |
| uses: azure/setup-helm@v3 | |
| - name: Update Chart version | |
| uses: mikefarah/yq@master | |
| with: | |
| cmd: yq -i '.version = "${{ needs.release.outputs.version }}"' 'charts/github-deploy-key-operator/Chart.yaml' | |
| - name: Update Chart appVersion | |
| uses: mikefarah/yq@master | |
| with: | |
| cmd: yq -i '.appVersion = "${{ needs.release.outputs.version }}"' 'charts/github-deploy-key-operator/Chart.yaml' | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Push Helm chart to OCI registry | |
| run: | | |
| helm package charts/github-deploy-key-operator | |
| helm push github-deploy-key-operator-${{ needs.release.outputs.version }}.tgz oci://${{ env.REGISTRY }}/${{ github.repository }} |