-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidate tag builds and rebuilds to one workflow. (#2)
- Loading branch information
1 parent
b790ff5
commit 63da8b3
Showing
3 changed files
with
69 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: build-tags | ||
|
||
on: | ||
# build when a new tag is created | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
# rebuild tags on a cron | ||
schedule: | ||
# * is a special character in YAML so you have to quote this string | ||
- cron: '0 * * * *' | ||
|
||
jobs: | ||
|
||
provide-tags: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# checkout repo with all tags | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# set matrix output to all git tags listed in a JSON-parsable array | ||
- id: set-matrix | ||
run: echo "::set-output name=matrix::$( jq -cRs 'split("\n")[:-1]' <<< $(git tag -l) )" | ||
|
||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
|
||
rebuild-tags: | ||
|
||
needs: provide-tags | ||
|
||
runs-on: ubuntu-latest | ||
|
||
env: | ||
DOCKER_HUB_ACCOUNT: bmngld | ||
|
||
# run a dynamic matrix of builds, rebuilding and republishing provided tags | ||
strategy: | ||
matrix: | ||
tag: ${{ fromJson(needs.provide-tags.outputs.matrix) }} | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ matrix.tag }} | ||
|
||
- run: make ci | ||
env: | ||
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | ||
|
||
- id: set-docker-hub | ||
run: echo "::set-output name=docker-hub::$( echo $DOCKER_HUB_ACCOUNT )" | ||
|
||
- id: set-repo-name | ||
run: echo "::set-output name=repo-name::$( basename `git rev-parse --show-toplevel` )" | ||
|
||
- id: set-docker-tag | ||
run: echo "::set-output name=docker-tag::$( echo ${{ steps.set-docker-hub.outputs.docker-hub }}/${{ steps.set-repo-name.outputs.repo-name }}:${{ matrix.tag }} )" | ||
|
||
- run: "docker tag test ${{ steps.set-docker-tag.outputs.docker-tag }}" | ||
|
||
- run: "echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login --username ${{ steps.set-docker-hub.outputs.docker-hub }} --password-stdin" | ||
|
||
- run: "docker push ${{ steps.set-docker-tag.outputs.docker-tag }}" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.