-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea34532
commit e83e443
Showing
2 changed files
with
67 additions
and
17 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,18 +1,68 @@ | ||
name: CI | ||
# vim: ts=2 sw=2: | ||
|
||
on: [push] | ||
name: Docker Build and Deploy | ||
|
||
jobs: | ||
build-and-publish-latest: | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/master' # Running this job only for master branch | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- master | ||
push: | ||
# Publish `master` as Docker `dev` image. | ||
branches: | ||
- master | ||
# Publish `v*` tags as x.x.x images and as `latest`. | ||
tags: | ||
- v* | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
docker: | ||
name: Build and push docker images | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v2 # Checking out the repo | ||
- name: Checkout | ||
uses: classabbyamp/treeless-checkout-action@v1 | ||
|
||
- name: Write ref to file | ||
if: ${{ github.event_name != 'pull_request' }} | ||
run: git rev-list -n 1 $GITHUB_REF > ./git_commit | ||
|
||
- name: Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: | | ||
ghcr.io/${{ github.repository }} | ||
tags: | | ||
type=sha,prefix= | ||
type=raw,value=dev,enable={{is_default_branch}} | ||
type=match,pattern=v(.*),group=1 | ||
labels: | | ||
org.opencontainers.image.authors=classabbyamp | ||
org.opencontainers.image.url=https://github.com/classabbyamp/qsl-generator | ||
org.opencontainers.image.source=https://github.com/${{ github.repository }} | ||
org.opencontainers.image.vendor=classabbyamp | ||
org.opencontainers.image.title=qsl-generator | ||
org.opencontainers.image.description=flask webapp to generate QSL card designs | ||
org.opencontainers.image.licenses=MIT | ||
- name: Build and Publish latest Docker image | ||
uses: VaultVulp/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} # Provide GITHUB_TOKEN to login into the GitHub Packages | ||
image-name: qsl-generator # Provide only Docker image name, tag will be automatically set to latest | ||
- name: Login to Github Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
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