2020-10-06 19:13:00 -04:00
|
|
|
# vim: ts=2 sw=2:
|
|
|
|
|
|
|
|
name: Docker Build and Deploy
|
2020-03-28 18:18:29 -04:00
|
|
|
|
|
|
|
on:
|
2023-12-10 15:10:22 -05:00
|
|
|
workflow_dispatch:
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
2020-03-28 18:18:29 -04:00
|
|
|
push:
|
|
|
|
# Publish `master` as Docker `dev` image.
|
|
|
|
branches:
|
|
|
|
- master
|
2020-10-06 19:13:00 -04:00
|
|
|
# Publish `v*` tags as x.x.x images and as `latest`.
|
2020-03-28 18:18:29 -04:00
|
|
|
tags:
|
|
|
|
- v*
|
|
|
|
|
2023-12-10 15:10:22 -05:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2020-03-28 18:18:29 -04:00
|
|
|
jobs:
|
2020-10-06 19:13:00 -04:00
|
|
|
docker:
|
|
|
|
name: Build and push docker images
|
2023-12-10 15:10:22 -05:00
|
|
|
runs-on: ubuntu-latest
|
2022-10-12 00:56:56 -04:00
|
|
|
permissions:
|
|
|
|
packages: write
|
2020-03-28 18:18:29 -04:00
|
|
|
steps:
|
2020-10-06 19:13:00 -04:00
|
|
|
- name: Checkout
|
2023-12-10 15:10:22 -05:00
|
|
|
uses: classabbyamp/treeless-checkout-action@v1
|
2020-10-06 19:13:00 -04:00
|
|
|
|
|
|
|
- name: Write ref to file
|
2023-12-10 15:10:22 -05:00
|
|
|
if: ${{ github.event_name != 'pull_request' }}
|
2020-10-06 19:13:00 -04:00
|
|
|
run: git rev-list -n 1 $GITHUB_REF > ./git_commit
|
2020-03-28 18:18:29 -04:00
|
|
|
|
2023-12-10 15:10:22 -05:00
|
|
|
- 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}}
|
2023-12-15 14:15:53 -05:00
|
|
|
type=ref,event=tag,prefix=,enable={{is_default_branch}}
|
2023-12-10 15:10:22 -05:00
|
|
|
labels: |
|
|
|
|
org.opencontainers.image.authors=classabbyamp and 0x5c
|
|
|
|
org.opencontainers.image.url=https://github.com/miaowware/qrm2
|
|
|
|
org.opencontainers.image.source=https://github.com/${{ github.repository }}
|
|
|
|
org.opencontainers.image.vendor=miaowware
|
|
|
|
org.opencontainers.image.title=qrm2
|
|
|
|
org.opencontainers.image.description=Discord bot with ham radio functions
|
2020-03-28 18:18:29 -04:00
|
|
|
|
2021-07-01 09:58:20 -04:00
|
|
|
- name: Login to Github Container Registry
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2020-03-28 18:18:29 -04:00
|
|
|
|
2023-12-10 15:10:22 -05:00
|
|
|
- name: Build and push
|
|
|
|
uses: docker/build-push-action@v5
|
2020-10-11 14:42:09 -04:00
|
|
|
with:
|
2023-12-10 15:10:22 -05:00
|
|
|
context: .
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|