Skip to content

Commit

Permalink
Add go-cache and trigger Docker release from published Release (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
mahlunar authored Mar 3, 2022
1 parent 040f727 commit 396d027
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
name: "CI"
on: [push, pull_request]
on:
push:
branches:
- "master"
pull_request:

jobs:
basic-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-go@v3
with:
go-version: "1.17"

- name: Cache Go modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: "Formatting check"
run: make fmt

Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
name: "Release"
on:
push:
tags:
- "v*"
release:
types: [published]

jobs:
docker:
runs-on: ubuntu-latest
if: github.event.release.target_commitish == 'master'
steps:
- uses: actions/checkout@v3

- uses: actions/setup-go@v3
with:
go-version: "1.17"
go-version: "1.17.7"

- name: Set tag in environment
run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV # extracts the tag name from refs/tags/v1.2.3
Expand All @@ -21,9 +22,9 @@ jobs:

- name: "Docker login to Quay.io"
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD quay.io
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
run: docker login -u $QUAY_USERNAME -p $QUAY_PASSWORD quay.io

- name: "Push image"
run: make docker-push TAG=$RELEASE_VERSION

0 comments on commit 396d027

Please sign in to comment.