-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (55 loc) · 1.78 KB
/
release-dev.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Release Image (Development)
on:
pull_request:
types:
- labeled
workflow_dispatch:
jobs:
release-docker:
name: Release Image
runs-on: ubuntu-latest
if: |
github.event_name == 'workflow_dispatch' ||
contains(github.event.pull_request.labels.*.name, 'deploy')
steps:
- name: Select branch
id: select_branch
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "branch=main" >> $GITHUB_OUTPUT
else
echo "branch=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT
fi
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ steps.select_branch.outputs.branch }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push PR image
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:development
labels: |
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
build-args: |
BUILDKIT_INLINE_CACHE=1
- name: Save branch name artifact
run: |
mkdir -p ./branch
echo -n ${{ steps.select_branch.outputs.branch }} > ./branch/branch
- name: Upload branch name artifact
uses: actions/upload-artifact@v3
with:
name: branch
path: branch/
retention-days: 1