-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (62 loc) · 2 KB
/
container.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
68
69
name: Container
on:
push:
tags: ["v*"]
jobs:
container:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Docker setup Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata action
uses: docker/metadata-action@v5
id: meta
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
type=ref,event=branch
type=semver,pattern={{raw}}
type=sha,enable=true,priority=100,prefix=commit-,suffix=,format=short
- name: Publish images
uses: docker/build-push-action@v5
with:
context: Net.Vatprc.Uniapi
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
needs: [container]
env:
RELEASE_VERSION: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v4
with:
repository: "xfoxfu/infra"
token: ${{ secrets.GH_TOKEN_INFRA }}
- name: Install jq and moreutils (sponge)
run: |
sudo apt-get update
sudo apt-get install jq moreutils
- run: |
jq '.["uniapi"]="${{ github.ref_name }}"' release.json | sponge release.json
- name: Push update
run: |
git config --global user.email [email protected]
git config --global user.name 'VATPRC GitOps'
git add .
git commit --message 'feat: upgrade uniapi to ${{ github.ref_name }}'
git push -u origin HEAD:main