-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add gh-action to publish docker image
This Action Publishes a Docker image of the project to the Github Container Registry for the repo. Also does neat tagging with versions :) chore: shift publish workflow to proper directory chore: fix label in Dockerfile
- Loading branch information
Showing
3 changed files
with
39 additions
and
1 deletion.
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
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,36 @@ | ||
name: Publish Docker image | ||
on: | ||
workflow_dispatch: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
push_to_registry: | ||
name: Push Docker image to GitHub Packages | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: check out the repo | ||
uses: actions/checkout@v2 | ||
- name: get project version | ||
id: get_version | ||
run: | | ||
echo ::set-output name=version_tag::$(awk -F'[ ="]+' '$1 == "version" { print $2 }' pyproject.toml) | ||
echo "project version - v${{ steps.get_version.outputs.version_tag }}" | ||
- name: version dockerfile | ||
run: sed -i 's/v0.0.0/v${{ steps.get_version.outputs.version_tag}}/g' Dockerfile | ||
- name: set up Docker builder | ||
uses: docker/setup-buildx-action@v1 | ||
- name: log into GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: push to Github Container Registry | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: | | ||
ghcr.io/heptagram-bot/api:v${{ steps.get_version.outputs.version_tag}} | ||
ghcr.io/heptagram-bot/api:latest |
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