-
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.
Merge pull request #1 from riege/BUILD-52_Provide_GitHub_Action_to_de…
…termine_container_image_tag BUILD-52 Provide GitHub action to determine the version
- Loading branch information
Showing
24 changed files
with
1,702 additions
and
2 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,24 @@ | ||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
action_outputs: | ||
runs-on: ubuntu-latest | ||
name: Test action | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Use Node.js 12 | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
- run: npm ci | ||
- run: npm test | ||
- uses: ./ | ||
id: version | ||
- run: | | ||
export VERSION="${{ steps.version.outputs.version }}" | ||
echo "$VERSION must match .+-.+-.+" | ||
bash -c '[[ $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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.idea | ||
|
||
node_modules/* | ||
|
||
!node_modules/@actions |
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 |
---|---|---|
@@ -1,2 +1,34 @@ | ||
# action-container-image-tag | ||
A GitHub action to determine a container image tag | ||
# action-version | ||
A GitHub action to determine the version for build artifacts. | ||
|
||
## Outputs | ||
version: The version string | ||
|
||
| CI/CD Build | Version | | ||
| ----------- | ----------- | | ||
| Git tag x.y.z on master branch (a prefixed "v" is okay, too) | X.Y.Z, X.Y, X, vX.Y.Z ... | | ||
| Untagged main commit | main-\<runnumber\>-\<sha\> | | ||
| Pull request | pr-\<prnumber\>-\<runnumber\>-\<sha\> | ||
|
||
## Example Usage | ||
``` | ||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
release: | ||
branches: [ main ] | ||
types: [published] | ||
jobs: | ||
action_outputs: | ||
runs-on: ubuntu-latest | ||
name: Echo action's outputs | ||
steps: | ||
- id: version | ||
uses: riege/[email protected] | ||
- run: | | ||
echo Version: ${{ steps.version.outputs.version }} | ||
echo Image tag: "${{ secrets.ACR_LOGIN_SERVER }}/my-container:${{ steps.version.outputs.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: 'Version' | ||
description: 'Determine the version for the build artifacts' | ||
|
||
outputs: | ||
version: | ||
description: "The version string" | ||
|
||
runs: | ||
using: "node12" | ||
main: "index.js" |
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,9 @@ | ||
const core = require('@actions/core'); | ||
const getVersion = require('./version'); | ||
|
||
try { | ||
const version = getVersion.get(process.env.GITHUB_REF, process.env.GITHUB_RUN_NUMBER, process.env.GITHUB_SHA); | ||
core.setOutput("version", version); | ||
} catch (error) { | ||
core.setFailed(error.message); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.