-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Add new workflows See this PR in [publish_gem_to_github](actionshub/publish-gem-to-github#11) for more details Signed-off-by: Dan Webb <[email protected]> * Update actions.yml --------- Signed-off-by: Dan Webb <[email protected]> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
0f4c796
commit a1960bd
Showing
3 changed files
with
38 additions
and
60 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 |
---|---|---|
@@ -1,19 +1,39 @@ | ||
--- | ||
name: Build & Publish container | ||
"on": | ||
pull_request: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
publish: | ||
build_and_publish: | ||
name: Build & Publish to GitHub Container Registry | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
steps: | ||
- name: Code checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
|
||
- name: Dry Run Bump version and push tag | ||
id: dry_run_tag_version | ||
if: github.event_name == 'pull_request' | ||
uses: mathieudutour/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
dry_run: true | ||
|
||
- name: Bump version and push tag | ||
id: tag_version | ||
if: github.ref == 'refs/heads/main' | ||
uses: mathieudutour/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
default_bump: false | ||
dry_run: false | ||
|
||
- name: Docker metadata | ||
id: meta | ||
|
@@ -36,23 +56,33 @@ jobs: | |
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: actions/checkout@main | ||
- name: Update actions.yml | ||
if: github.event_name == 'pull_request' | ||
uses: mikefarah/[email protected] | ||
with: | ||
cmd: yq e -i '.runs.image = "docker://ghcr.io/${{ github.repository }}:${{ steps.dry_run_tag_version.outputs.new_tag }}"' action.yml | ||
|
||
- name: Commit Changes to actions.yml | ||
if: github.event_name == 'pull_request' | ||
uses: EndBug/add-and-commit@v9 | ||
with: | ||
message: "Update actions.yml" | ||
add: "action.yml" | ||
default_author: github_actions | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository }}:${{ steps.tag_version.outputs.new_tag }} | ||
ghcr.io/${{ github.repository }}:latest | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
- name: Create a GitHub release | ||
if: github.ref == 'refs/heads/main' | ||
uses: ncipollo/[email protected] | ||
with: | ||
tag: ${{ steps.tag_version.outputs.new_tag }} | ||
name: Release ${{ steps.tag_version.outputs.new_tag }} | ||
body: ${{ steps.tag_version.outputs.changelog }} | ||
generateReleaseNotes: true |
This file was deleted.
Oops, something went wrong.
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