-
-
Notifications
You must be signed in to change notification settings - Fork 88
79 lines (66 loc) · 2.31 KB
/
create_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
name: Upload the latest release
on:
push:
tags: [ "v*" ]
jobs:
create:
name: "Creates the newest release by version"
runs-on: "ubuntu-latest"
steps:
- name: Checkout project
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Set up Docker Build
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get version from tag
id: get_version
run: echo "::set-output name=version::${GITHUB_REF#refs/tags/v}"
- name: Update package.json version
run: |
jq ".version = \"${{ steps.get_version.outputs.version }}\"" package.json > tmp.json
mv tmp.json package.json
- name: Check if there are changes to commit
id: check_changes
run: |
git add package.json
if git diff-index --quiet HEAD --; then
echo "No changes to commit."
echo "::set-output name=changes::false"
else
echo "::set-output name=changes::true"
fi
- name: Commit version change to main
if: steps.check_changes.outputs.changes == 'true'
run: |
git config --local user.name "GitHub Actions"
git config --local user.email "[email protected]"
git commit -m "Update version to ${{ steps.get_version.outputs.version }}"
git push origin HEAD:main
- name: Create GitHub Release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
title: Release ${{ steps.get_version.outputs.version }}
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: |
germannewsmaker/nexterm:latest
germannewsmaker/nexterm:${{ steps.get_version.outputs.version }}