-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (60 loc) · 1.61 KB
/
docker.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
56
57
58
59
60
61
62
63
64
65
66
67
name: Build Docker Image
on:
pull_request:
jobs:
docker:
name: Build docker image
runs-on: ubuntu-latest
if:
(
contains(github.event.pull_request.labels.*.name, 'dependencies') == true &&
github.base_ref == 'main'
) ||
contains(github.event.pull_request.labels.*.name, 'ci') == true
permissions:
contents: read
packages: write
steps:
- name: Checkout Main
uses: actions/checkout@v3
with:
sparse-checkout: |
Dockerfile
requirements.txt
- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: huangfusl
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build docker image
run: |
docker build -t ghcr.io/huangfusl/blog-env:test .
docker push ghcr.io/huangfusl/blog-env:test
test:
needs: docker
name: Test
uses: ./.github/workflows/build.yml
with:
build-type: test
deploy: false
secrets: inherit
update-tag:
needs: test
name: Update tag
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: huangfusl
password: ${{ secrets.GITHUB_TOKEN }}
# Retag image
- name: Retag image
run: |
docker pull ghcr.io/huangfusl/blog-env:test
docker tag ghcr.io/huangfusl/blog-env:test ghcr.io/huangfusl/blog-env:build
docker push ghcr.io/huangfusl/blog-env:build