Skip to content

Commit

Permalink
Add a publish workflow and edit the README file
Browse files Browse the repository at this point in the history
  • Loading branch information
mini-bomba committed Jun 20, 2022
1 parent 3094d60 commit df6c2c1
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 1 deletion.
43 changes: 43 additions & 0 deletions .github/workflows/publish-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Publish container image

on:
push:
branches:
- 'main'
tags:
- 'v*'

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Aquire code
if: always()
uses: actions/checkout@v2
- name: Log into ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/mini-bomba/create-github-release
tags: |
type=ref,event=branch
type=semver,pattern={{raw}}
type=sha,prefix=,suffix=,format=short
- name: Build & push image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.9.6-slim-buster
LABEL org.opencontainers.image.source=https://github.com/mini-bomba/create-github-release

# Install git
RUN apt-get update && apt-get install git -y --no-install-recommends
Expand Down
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
# would go here
#
- name: Release the new binaries
uses: mini-bomba/create-github-release@v1.0.0
uses: mini-bomba/create-github-release@v1.1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: "latest"
Expand All @@ -89,4 +89,23 @@ jobs:
build/*.exe
clear_attachments: true
```
## Using the ghcr.io image instead of building on demand
I provide automatically-built docker images via Gihub Packages, which are compatible with any workflows using the action.
If my action takes too long to build on demand for you, or if you have issues with multiple copies cluttering up your
selfhosted runner's disk space, you can use the prebuilt images instead.
To replace the action with the prebuilt image, simply replace
```yaml
uses: mini-bomba/[email protected]
```
with
```yaml
uses: docker://ghcr.io/mini-bomba/[email protected]
```
in your workflows.
The images are built for any version tag and any commit on the main branch.
Note that commit images are tagged with the first 7 characters of the commit hash.
See the package page for more info.
The images should work in the same way as the action, no further changes to the workflow should be required.

0 comments on commit df6c2c1

Please sign in to comment.