diff --git a/.github/workflows/prod-docker-mainnet.yml b/.github/workflows/prod-docker-mainnet.yml index a946aaa..d6d3d5c 100644 --- a/.github/workflows/prod-docker-mainnet.yml +++ b/.github/workflows/prod-docker-mainnet.yml @@ -4,8 +4,6 @@ on: push: branches: - main - release: - types: [created] env: ENV: "prd" @@ -23,20 +21,17 @@ jobs: fetch-depth: 100 ref: ${{ github.event.pull_request.head.sha }} - - uses: GoogleCloudPlatform/release-please-action@v2 - id: release - with: - token: ${{ secrets.GITHUB_TOKEN }} - release-type: node - package-name: "" - changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"ci","section":"CI / CD","hidden":false},{"type":"test","section":"Testing","hidden":false},{"type":"refactor","section":"Refactorings","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false}]' + - name: Get tags + run: git fetch --tags origin + + - name: Get latest release tag + shell: bash + id: release_tag + run: echo TAG=$(git describe --tags HEAD --abbrev=0) >> $GITHUB_OUTPUT - name: Set up Docker Buildx id: buildx - # Use the action from the master, as we've seen some inconsistencies with @v1 - # Issue: https://github.com/docker/build-push-action/issues/286 uses: docker/setup-buildx-action@master - # Only worked for us with this option on �‍♂️ with: install: true @@ -44,7 +39,6 @@ jobs: uses: actions/cache@v2 with: path: /tmp/.buildx-cache - # Key is named differently to avoid collision key: ${{ runner.os }}-${{ env.ENV }}-buildx-${{ github.sha }} restore-keys: | ${{ runner.os }}-${{ env.ENV }}-buildx @@ -64,10 +58,7 @@ jobs: with: images: aeternitybot/dex-backend-mainnet tags: | - type=raw,value=latest,enable=${{ endsWith(GitHub.ref, 'main') }} - type=raw,value=${{ steps.release.outputs.tag_name }},enable=${{ endsWith(GitHub.ref, 'main') }} - type=ref,event=tag - type=ref,event=pr + type=raw,value=${{ steps.release_tag.outputs.TAG }} - name: Build and push docker image if: | @@ -81,9 +72,6 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=local,src=/tmp/.buildx-cache - # Note the mode=max here - # More: https://github.com/moby/buildkit#--export-cache-options - # And: https://github.com/docker/buildx#--cache-tonametypetypekeyvalue cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new - name: Move cache @@ -101,10 +89,10 @@ jobs: fetch-depth: 0 - name: Production Deploy - if: ${{ steps.release.outputs.release_created }} uses: aeternity/ae-github-actions/argocd-deploy@v4 with: - url-prefix: ${{ steps.release.outputs.tag_name }} + git-sha: ${{ steps.git-sha.outputs.GIT_SHA }} + url-prefix: ${{ steps.release_tag.outputs.TAG }}} env: ${{ env.ENV }} app: ${{ env.APP }} diff --git a/.github/workflows/prod-docker-testnet.yml b/.github/workflows/prod-docker-testnet.yml index 3516b03..8976877 100644 --- a/.github/workflows/prod-docker-testnet.yml +++ b/.github/workflows/prod-docker-testnet.yml @@ -4,8 +4,6 @@ on: push: branches: - main - release: - types: [created] env: ENV: "prd" @@ -23,20 +21,17 @@ jobs: fetch-depth: 100 ref: ${{ github.event.pull_request.head.sha }} - - uses: GoogleCloudPlatform/release-please-action@v2 - id: release - with: - token: ${{ secrets.GITHUB_TOKEN }} - release-type: node - package-name: "" - changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"ci","section":"CI / CD","hidden":false},{"type":"test","section":"Testing","hidden":false},{"type":"refactor","section":"Refactorings","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false}]' + - name: Get tags + run: git fetch --tags origin + + - name: Get latest release tag + shell: bash + id: release_tag + run: echo TAG=$(git describe --tags HEAD --abbrev=0) >> $GITHUB_OUTPUT - name: Set up Docker Buildx id: buildx - # Use the action from the master, as we've seen some inconsistencies with @v1 - # Issue: https://github.com/docker/build-push-action/issues/286 uses: docker/setup-buildx-action@master - # Only worked for us with this option on �‍♂️ with: install: true @@ -44,7 +39,6 @@ jobs: uses: actions/cache@v2 with: path: /tmp/.buildx-cache - # Key is named differently to avoid collision key: ${{ runner.os }}-${{ env.ENV }}-buildx-${{ github.sha }} restore-keys: | ${{ runner.os }}-${{ env.ENV }}-buildx @@ -64,10 +58,7 @@ jobs: with: images: aeternitybot/dex-backend-testnet tags: | - type=raw,value=latest,enable=${{ endsWith(GitHub.ref, 'main') }} - type=raw,value=${{ steps.release.outputs.tag_name }},enable=${{ endsWith(GitHub.ref, 'main') }} - type=ref,event=tag - type=ref,event=pr + type=raw,value=${{ steps.release_tag.outputs.TAG }} - name: Build and push docker image if: | @@ -81,9 +72,6 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=local,src=/tmp/.buildx-cache - # Note the mode=max here - # More: https://github.com/moby/buildkit#--export-cache-options - # And: https://github.com/docker/buildx#--cache-tonametypetypekeyvalue cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new - name: Move cache @@ -101,10 +89,10 @@ jobs: fetch-depth: 0 - name: Production Deploy - if: ${{ steps.release.outputs.release_created }} uses: aeternity/ae-github-actions/argocd-deploy@v4 with: - url-prefix: ${{ steps.release.outputs.tag_name }} + git-sha: ${{ steps.git-sha.outputs.GIT_SHA }} + url-prefix: ${{ steps.release_tag.outputs.TAG }} env: ${{ env.ENV }} app: ${{ env.APP }} diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml new file mode 100644 index 0000000..b92e27e --- /dev/null +++ b/.github/workflows/release-please.yaml @@ -0,0 +1,24 @@ +name: Release Dex Backend + +on: + push: + branches: + - main + +jobs: + release: + runs-on: ubuntu-latest + name: Release Please + + steps: + - name: Checkout Code + uses: actions/checkout@v2 + + - name: Release Please Action + id: release + uses: GoogleCloudPlatform/release-please-action@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + release-type: node + package-name: "" + changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"ci","section":"CI / CD","hidden":false},{"type":"test","section":"Testing","hidden":false},{"type":"refactor","section":"Refactorings","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false}]'