Skip to content

Commit

Permalink
feat(ci): add build stage
Browse files Browse the repository at this point in the history
  • Loading branch information
vareversat committed Oct 10, 2023
1 parent 82b42b9 commit 1bac6f2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ jobs:
go-test:
uses: ./.github/workflows/go.test.action.yaml
with:
go_version: '1.21.2'
go_version: '1.21.2'
go-build:
needs: [ got-lint, go-test ]
uses: ./.github/workflows/go.build.action.yaml
28 changes: 28 additions & 0 deletions .github/workflows/go.build.action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: GO - Build

on: workflow_call

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4.1.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: 'Generate build number'
run: |
BUILD_NUMBER=$(git rev-list --all --count)
echo "BUILD_NUMBER=$BUILD_NUMBER" >> $GITHUB_ENV
echo "This build is tagged as $BUILD_NUMBER on $GITHUB_REF"
- name: Build and export
uses: docker/build-push-action@v5
with:
context: .
tags: chabo-api:${{ env.GITHUB_REF }}+${{ env.BUILD_NUMBER }}
outputs: type=docker,dest=/tmp/chabo-api-image.tar
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: chabo-api-image
path: /tmp/chabo-api-image.tar
5 changes: 4 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ jobs:
go-test:
uses: ./.github/workflows/go.test.action.yaml
with:
go_version: '1.21.2'
go_version: '1.21.2'
go-build:
needs: [ got-lint, go-test ]
uses: ./.github/workflows/go.build.action.yaml

0 comments on commit 1bac6f2

Please sign in to comment.