forked from OwnZones/orchestration-gui
-
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.
chore: build and push image on release (#5)
- Loading branch information
Showing
2 changed files
with
77 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,54 @@ | ||
name: Build and push Docker image when a release is published | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
name: Build and push Docker image | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log in to Docker registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Extract GUI version | ||
id: gui | ||
env: | ||
TAGS: ${{ steps.meta.outputs.tags }} | ||
run: echo "::set-output name=version::${TAGS##*:}" | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: true | ||
build-args: | | ||
GUI_VERSION=${{ steps.gui.outputs.version }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64,linux/arm64 |
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,23 @@ | ||
To build and publish a release of the official Docker image, in this example patch version `v1.0.1`: | ||
|
||
1. Create a tag with name `v1.0.1` | ||
|
||
``` | ||
% git tag v1.0.1 | ||
``` | ||
|
||
2. Push the tag to GitHub remote | ||
|
||
``` | ||
% git push --tags | ||
``` | ||
|
||
3. Open browser and navigate to the repository on GitHub. Go to the Releases section by clicking on the Releases header on the right side of the page. | ||
|
||
4. Click on Create a new release and choose the tag `v1.0.1` that you created. | ||
|
||
5. Describe the release by adding release notes in the markdown input field. | ||
|
||
6. Click on Publish release. | ||
|
||
This will trigger a GitHub action that will build Docker image and tag it with `v1.0.1` and push to container registry. |