Skip to content

Commit

Permalink
update go-version to 1.21, add build & push docker workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
derrick-dacosta committed Feb 26, 2024
1 parent ee0f53d commit b27da14
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 4 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/build-push-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: 'build & push docker staging'

on:
pull_request_target:
branches: [main]
types:
- closed

jobs:
if_merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Setup golang environment
uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: Install dependencies
run: go mod tidy

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_ENDPOINT }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: set build env variables
shell: bash
run: |
REPO_VERSION=$(git rev-parse --git-dir > /dev/null 2>&1 && git fetch -q origin --tags && git describe --always --dirty --tags)
REPO_REV=$(git rev-parse --git-dir > /dev/null 2>&1 && git rev-parse HEAD 2>/dev/null)
BUILD_DATE=$(date -u +%FT%T)
echo "REPO_VERSION=$REPO_VERSION" >> $GITHUB_ENV
echo "REPO_REV=$REPO_REV" >> $GITHUB_ENV
echo "BUILD_DATE=$BUILD_DATE" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: |
VERSION=${{ env.REPO_VERSION }}
REPO_REV=${{ env.REPO_REV }}
DATE=${{ env.BUILD_DATE }}
tags: ${{ secrets.DOCKER_ENDPOINT }}${{ secrets.DOCKER_REPO }}/fishymetrics:${{ env.REPO_VERSION }}
8 changes: 4 additions & 4 deletions .github/workflows/pr-prechecks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup golang environment
uses: actions/setup-go@v4
with:
go-version: '1.19'
go-version: '1.21'

- name: Install dependencies
run: go mod tidy
Expand All @@ -36,12 +36,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup golang environment
uses: actions/setup-go@v4
with:
go-version: '1.19'
go-version: '1.21'

- name: Install dependencies
run: go mod tidy
Expand Down

0 comments on commit b27da14

Please sign in to comment.