-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (47 loc) · 1.41 KB
/
release.yml
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: release
on:
push:
branches:
- main
release:
types: [published]
env:
DOCKER_BASE_NAME: ghcr.io/${{ github.repository }}
jobs:
hadolint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: Dockerfile
push-image:
runs-on: ubuntu-latest
needs: hadolint
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Set Env
run: |
if [ "${{ github.event_name }}" = 'release' ]; then
export TAG_NAME="${{ github.event.release.tag_name }}"
else
export TAG_NAME="latest"
fi
echo "PKG_TAG"=${DOCKER_BASE_NAME}:${TAG_NAME} >> ${GITHUB_ENV}
- name: Build Image
run: |
docker build . -t "${PKG_TAG}"
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Image
run: |
docker push "${PKG_TAG}"