-
Notifications
You must be signed in to change notification settings - Fork 7
47 lines (45 loc) · 1.56 KB
/
docker.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Publish docker
on:
workflow_dispatch:
push:
branches:
- master
tags:
- v*
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Extract Version Name
id: extract_version
uses: actions/github-script@v6
with:
result-encoding: string
script: |
if (context.payload.ref.startsWith('refs/tags/')) {
return context.payload.ref.replace(/refs\/tags\/v/, '');
}
return 'dev';
- name: Checkout code
uses: actions/checkout@v3
- name: Build docker
env:
VERSION: ${{ steps.extract_version.outputs.result }}
run: docker build -t ghcr.io/rikudousage/fediseer-gui:$VERSION --label "org.opencontainers.image.source=https://github.com/RikudouSage/FediseerGUI" --label "org.opencontainers.image.licenses=MIT" .
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push to docker
env:
VERSION: ${{ steps.extract_version.outputs.result }}
run: docker push ghcr.io/rikudousage/fediseer-gui:$VERSION
- name: Push latest to docker
if: steps.extract_version.outputs.result != 'dev'
env:
VERSION: ${{ steps.extract_version.outputs.result }}
run: |
docker tag ghcr.io/rikudousage/fediseer-gui:$VERSION ghcr.io/rikudousage/fediseer-gui:latest
docker push ghcr.io/rikudousage/fediseer-gui:latest