-
-
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.
* fix: Docker tag on main - Docker tag wasn't set correctly - Set a pretty commit message for Actions update 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
13f22fc
commit 1f70dbb
Showing
3 changed files
with
76 additions
and
32 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,7 +1,6 @@ | ||
--- | ||
name: Build & Publish container | ||
"on": | ||
pull_request: | ||
push: | ||
branches: [main] | ||
|
||
|
@@ -19,22 +18,6 @@ jobs: | |
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 }} | ||
dry_run: false | ||
|
||
- name: Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
|
@@ -56,19 +39,12 @@ jobs: | |
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- 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 | ||
- name: Bump version and push tag | ||
id: tag_version | ||
uses: mathieudutour/[email protected] | ||
with: | ||
message: "Update actions.yml" | ||
add: "action.yml" | ||
default_author: github_actions | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
dry_run: false | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
|
@@ -78,11 +54,10 @@ jobs: | |
push: true | ||
tags: | | ||
${{ steps.meta.outputs.tags }} | ||
${{ steps.tag_version.outputs.new_tag }} | ||
ghcr.io/${{ github.repository }}:${{ steps.tag_version.outputs.new_tag }} | ||
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 }} | ||
|
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 & Publish container | ||
"on": | ||
pull_request: | ||
|
||
jobs: | ||
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: Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ghcr.io/${{ github.repository }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Setup buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
install: true | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Bump version and push tag | ||
id: tag_version | ||
uses: mathieudutour/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
dry_run: true | ||
|
||
- name: Update actions.yml to ${{ steps.tag_version.outputs.new_tag }} | ||
uses: mikefarah/[email protected] | ||
with: | ||
cmd: yq e -i '.runs.image = "docker://ghcr.io/${{ github.repository }}:${{ steps.tag_version.outputs.new_tag }}"' action.yml | ||
|
||
- name: Commit Changes to actions.yml | ||
uses: EndBug/add-and-commit@v9 | ||
with: | ||
message: "Update actions.yml to ${{ steps.tag_version.outputs.new_tag }}" | ||
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: | | ||
${{ steps.meta.outputs.tags }} | ||
ghcr.io/${{ github.repository }}:${{ steps.tag_version.outputs.new_tag }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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