-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add APP_VERSION parsing to github actions
- Loading branch information
Showing
5 changed files
with
88 additions
and
0 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,14 @@ | ||
Testing GH Actions with [ACT] | ||
|
||
### Test Branch Push | ||
|
||
```shell | ||
act -W '.github/act/actTest.yml' -e '.github/act/actBranchEvent.json' | ||
``` | ||
|
||
|
||
### Test Tag Push | ||
|
||
```shell | ||
act -W '.github/act/actTest.yml' -e '.github/act/actTagEvent.json' | ||
``` |
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,4 @@ | ||
{ | ||
"ref": "refs/heads/master", | ||
"sha": "0a1a94d9ad4efa373f8d34aace5e7f0a3fff42ad" | ||
} |
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,5 @@ | ||
{ | ||
"ref": "refs/tags/0.8.0", | ||
"ref_name": "0.8.0", | ||
"sha": "0a1a94d9ad4efa373f8d34aace5e7f0a3fff42ad" | ||
} |
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,45 @@ | ||
name: Publish Docker image to Dockerhub | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
- 'develop' | ||
tags: | ||
- '*.*.*' | ||
# don't trigger if just updating docs | ||
paths-ignore: | ||
- '**.md' | ||
# use release instead of tags once version is correctly parsed | ||
# https://github.com/docker/metadata-action/issues/422 | ||
# https://github.com/docker/metadata-action/issues/240 | ||
# release: | ||
# types: [ published ] | ||
|
||
jobs: | ||
|
||
test: | ||
name: Build and push container images | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set short git commit SHA | ||
id: vars | ||
# https://dev.to/hectorleiva/github-actions-and-creating-a-short-sha-hash-8b7 | ||
# short sha available under env.COMMIT_SHORT_SHA | ||
run: | | ||
calculatedSha=$(git rev-parse --short ${{ github.sha }}) | ||
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV | ||
- name: Check App Version | ||
env: | ||
# use release instead of tags once version is correctly parsed | ||
#APP_VERSION: ${{ github.event.release.tag_name }} | ||
|
||
# https://github.com/actions/runner/issues/409#issuecomment-752775072 | ||
# https://stackoverflow.com/a/69919067/1469797 | ||
APP_VERSION: ${{ contains(github.ref, 'refs/tags/') && github.ref_name || format('{0}-{1}', github.ref_name, env.COMMIT_SHORT_SHA ) }} | ||
run: | | ||
echo $APP_VERSION |
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