Skip to content

Commit

Permalink
feat: add release workflow for api (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasyl-ivanchuk authored Sep 16, 2023
1 parent d36a71b commit ee4ea60
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,45 @@ jobs:
env:
GITHUB_TOKEN: ${{ github.token }}
run: npx semantic-release

createReleaseDockerImages:
name: Create Release Docker Images
runs-on: [self-hosted, default]
needs: createReleaseVersion
if: ${{ needs.createReleaseVersion.outputs.releaseVersion != '' }}
steps:
- uses: actions/checkout@v3

- name: Set up Docker Build
uses: docker/setup-buildx-action@v2

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Generate build ID for Flux Image Automation
id: setVersionForFlux
run: |
sha=$(git rev-parse --short HEAD)
ts=$(date +%s%N | cut -b1-13)
echo "::set-output name=imageTag::${sha}-${ts}"
- name: Auth to google artifact registry
run: |
gcloud auth configure-docker us-docker.pkg.dev -q
- name: Build and push Docker image for API
uses: docker/build-push-action@v4
with:
push: true
tags: |
"matterlabs/block-explorer-api:latest"
"matterlabs/block-explorer-api:v${{ needs.createReleaseVersion.outputs.releaseVersion }}"
"matterlabs/block-explorer-api:${{ steps.setVersionForFlux.outputs.imageTag }}"
"us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-api:latest"
"us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-api:v${{ needs.createReleaseVersion.outputs.releaseVersion }}"
"us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/block-explorer-api:${{ steps.setVersionForFlux.outputs.imageTag }}"
file: packages/api/Dockerfile
no-cache: true

0 comments on commit ee4ea60

Please sign in to comment.