-
Notifications
You must be signed in to change notification settings - Fork 6
99 lines (84 loc) · 2.79 KB
/
node-release.yml
File metadata and controls
99 lines (84 loc) · 2.79 KB
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
89
90
91
92
93
94
95
96
97
98
99
name: Publish node
on:
push:
tags:
- "node/v*"
concurrency:
group: ${{ github.workflow }}-${{ github.sha }}
cancel-in-progress: true
env:
WORKING_DIR: src
jobs:
container:
runs-on:
group: ton-large
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v5
- name: Get commit timestamp
id: commit
run: echo "date=$(git log -1 --format=%cI)" >> "$GITHUB_OUTPUT"
- uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/rsquad/ton-rust-node/node
tags: |
type=match,pattern=node/(v.*),group=1
type=raw,value=latest,enable=${{ !contains(github.ref_name, 'rc') && !contains(github.ref_name, 'alpha') && !contains(github.ref_name, 'beta') }}
type=sha
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./src
file: ./src/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
GIT_BRANCH=${{ github.ref_name }}
GIT_COMMIT=${{ github.sha }}
GIT_COMMIT_DATE=${{ steps.commit.outputs.date }}
cache-from: type=gha
cache-to: type=gha,mode=max
release:
needs: [container]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v5
- name: Extract version from tag
id: version
run: |
VERSION="${GITHUB_REF_NAME#node/}"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
if echo "$VERSION" | grep -qE '(rc|alpha|beta)'; then
echo "prerelease=true" >> "$GITHUB_OUTPUT"
else
echo "prerelease=false" >> "$GITHUB_OUTPUT"
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: "node/${{ steps.version.outputs.version }}"
body: |
node ${{ steps.version.outputs.version }}
Image: `ghcr.io/rsquad/ton-rust-node/node:${{ steps.version.outputs.version }}`
prerelease: ${{ steps.version.outputs.prerelease }}
make_latest: ${{ steps.version.outputs.prerelease != 'true' }}
draft: ${{ steps.version.outputs.prerelease }}
- name: Publish pre-release
if: steps.version.outputs.prerelease == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release edit "$GITHUB_REF_NAME" --draft=false