This repository has been archived by the owner on Aug 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
88 lines (75 loc) · 2.99 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
on:
push:
branches:
- master
name: Checkout and Create Release Version
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get version
id: get-version
run: |
version=$(cat VERSION)
echo "version=${version}" >> $GITHUB_OUTPUT
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare files
run: |
bash prepare.sh
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/mips64le
push: true
tags: |
jumpserver/web-static:${{ steps.get-version.outputs.version }}
ghcr.io/jumpserver/web-static:${{ steps.get-version.outputs.version }}
outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Create Tag
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git tag -a ${{ steps.get-version.outputs.version }} -m "Release Version ${{ steps.get-version.outputs.version }}" || echo "Tag already exists"
git push origin ${{ steps.get-version.outputs.version }} || echo "Tag already exists"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
run: |
gh release create ${{ steps.get-version.outputs.version }} --notes "Release ${{ steps.get-version.outputs.version }}" || echo "Release already exists"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Gitea Private Key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Sync to Gitea Repository
run: |
ssh -o StrictHostKeyChecking=no [email protected] || echo ""
rm -rf .git
git clone --depth=1 git@${{ github.repository }}.git
mv opt/* web-static/
git add .
git commit -m "Release Version ${{ steps.get-version.outputs.version }}"
git tag -a ${{ steps.get-version.outputs.version }} -m "Release Version ${{ steps.get-version.outputs.version }}"
git push origin ${{ steps.get-version.outputs.version }}