Skip to content

Commit

Permalink
Merge pull request #3 from matter-labs/ci-fix
Browse files Browse the repository at this point in the history
Proper tags for flux automation, other CI tweaks
  • Loading branch information
hatemosphere authored Sep 5, 2022
2 parents aa8fabc + 4472aa0 commit d41b61b
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 4 deletions.
36 changes: 34 additions & 2 deletions .github/workflows/build_and_publish.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: Build and publish fee-withdrawer-v2 image

on:
workflow_dispatch:
push:
branches:
- "main"
tags:
- "*"

jobs:
push_to_registry:
Expand All @@ -20,10 +24,38 @@ jobs:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Generate build ID for Flux Image Automation
id: tag
if: ${{ startsWith(github.ref, 'refs/tags') }}
run: |
echo "::set-output name=BUILD_ID::${GITHUB_REF#refs/*/}"
- name: Generate build ID for Flux Image Automation
id: build
if: ${{ !startsWith(github.ref, 'refs/tags') }}
run: |
sha=$(git rev-parse --short HEAD)
ts=$(date +%s)
echo "::set-output name=BUILD_ID::${sha}-${ts}"
- name: Build and push Docker image
uses: docker/[email protected]
if: ${{ startsWith(github.ref, 'refs/tags') }}
with:
push: true
tags: |
"matterlabs/fee-withdrawer-v2:latest"
"matterlabs/fee-withdrawer-v2:${{ steps.tag.outputs.BUILD_ID }}"
file: Dockerfile
no-cache: true

- name: Build and push Docker image
uses: docker/[email protected]
if: ${{ !startsWith(github.ref, 'refs/tags') }}
with:
push: true
tags: "matterlabs/fee-withdrawer-v2:latest"
tags: |
"matterlabs/fee-withdrawer-v2:latest"
"matterlabs/fee-withdrawer-v2:${{ steps.build.outputs.BUILD_ID }}"
file: Dockerfile
no-cache: true
18 changes: 16 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: CI

on: [push]
on:
pull_request:
branches:
- "main"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
Expand All @@ -11,6 +18,13 @@ jobs:

- name: install dependencies
run: yarn

- name: running tests
run: yarn test

- name: test Docker image build
uses: docker/[email protected]
with:
push: false
file: Dockerfile
no-cache: true

0 comments on commit d41b61b

Please sign in to comment.