-
-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (48 loc) · 1.56 KB
/
docker.yml
File metadata and controls
55 lines (48 loc) · 1.56 KB
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
48
49
50
51
52
53
54
55
name: Deploy Docker Image
on:
push:
tags:
- "v*"
branches: [main]
paths:
- "ExportAPI/**"
- "DiscordChatExporter/**"
jobs:
docker:
name: Docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Checkout submodules
shell: bash
run: |
git config --global url."https://github.com/".insteadOf "git@github.com:"
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
# if the commit is tagged, use the tag as the image tag
- name: Set image tag
id: image_tag
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
fi
- name: Build
id: build
uses: redhat-actions/buildah-build@v2
with:
image: fyko/export-api
tags: latest ${{ steps.image_tag.outputs.tag || '' }} ${{ github.sha }}
dockerfiles: |
./Dockerfile
build-args: |
CREATED_AT=${{ env.datetime }}
GITHUB_SHA=${{ github.sha }}
- name: Publish
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build.outputs.image }}
tags: ${{ steps.build.outputs.tags }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}