Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: refactor prod release #91

Merged
merged 5 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 10 additions & 22 deletions .github/workflows/prod-docker-mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
push:
branches:
- main
release:
types: [created]

env:
ENV: "prd"
Expand All @@ -23,28 +21,24 @@ 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

- name: Cache Docker layers
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
Expand All @@ -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: |
Expand All @@ -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
Expand All @@ -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 }}

Expand Down
32 changes: 10 additions & 22 deletions .github/workflows/prod-docker-testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
push:
branches:
- main
release:
types: [created]

env:
ENV: "prd"
Expand All @@ -23,28 +21,24 @@ 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

- name: Cache Docker layers
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
Expand All @@ -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: |
Expand All @@ -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
Expand All @@ -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 }}

Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
@@ -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}]'
Loading