-
Notifications
You must be signed in to change notification settings - Fork 0
154 lines (136 loc) · 4.59 KB
/
release.yml
File metadata and controls
154 lines (136 loc) · 4.59 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Release
on:
workflow_dispatch:
inputs:
version_increment:
description: 'La version a incrémenter (major, minor, patch)'
required: true
default: 'patch'
type: choice
options:
- 'major'
- 'minor'
- 'patch'
# build_docker_image:
# description: "Construire l'image docker ?"
# required: true
# default: true
# type: boolean
# latest:
# description: "Tagger l'image docker avec le tag 'latest' ?"
# required: true
# default: true
# type: boolean
jobs:
# build-docker:
# runs-on: ubuntu-latest
# permissions:
# contents: write
# packages: write
# steps:
# - name: Build docker
# uses: Libertech-FR/lt-actions/release@main
# with:
# version_increment: ${{ github.event.inputs.version_increment }}
# build_docker_image: ${{ github.event.inputs.build_docker_image }}
# latest: ${{ github.event.inputs.latest }}
# repository: ${{ github.repository }}
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# access_token: ${{ secrets.GITHUB_TOKEN }}
# github_token: ${{ secrets.GITHUB_TOKEN }}
# # Optional parameters, thoses are default values :
# registry: 'ghcr.io'
# context: .
build-pkg:
runs-on: ubuntu-latest
# using: "composite"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Git
shell: bash
run: |
git config user.email "github@action.com"
git config user.name "Github Action"
echo ${{ secrets.GITHUB_TOKEN }} > token.txt
git config credential.helper "store --file=token.txt"
- name: Update version
shell: bash
run: |
echo NEW_VERSION=$(yarn version --${{ inputs.version_increment }} --json | jq -r '.data | select(contains("New version")) | split(":")[1] | gsub(" ";"")') >> $GITHUB_ENV
env:
REF: ${{ github.ref }}
- name: Push to unprotected branch
shell: bash
run: |
git push --follow-tags
env:
REF: ${{ github.ref }}
# - name: Push to protected branch
# uses: CasperWA/push-protected@v2
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# branch: main
# unprotect_reviews: true
# tags: true
- name: Publish release
uses: ncipollo/release-action@v1
with:
name: Release ${{ env.NEW_VERSION }}
commit: ${{ env.REF }}
draft: false
prerelease: false
generateReleaseNotes: true
token: ${{ secrets.GITHUB_TOKEN }}
makeLatest: ${{ inputs.latest }}
tag: ${{ env.NEW_VERSION }}
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- run: npm install -g yarn
- run: yarn --frozen-lockfile
- run: npm install --global pkg
- run: yarn build
# - run: curl -sf https://gobinaries.com/tj/node-prune | sh
# - run: node-prune
- name: Build
run: pkg dist/main.js -o sesame-daemon-linux --targets linux --config package.json
- name: Upload Build Artifact
uses: actions/upload-artifact@v3
with:
name: sesame-daemon-linux
path: sesame-daemon-linux
- name: Download a Build Artifact
uses: actions/download-artifact@v3
with:
name: sesame-daemon-linux
- name: Init deb package
run: |
mkdir -p .debpkg/usr/bin
cp sesame-daemon-linux .debpkg/usr/bin/sesame-daemon
mkdir -p .debpkg/var/lib/sesame-daemon/backends
cp -r ./backends.example .debpkg/var/lib/sesame-daemon
chmod +x .debpkg/DEBIAN/postinst
chmod +x .debpkg/DEBIAN/postrm
- name: Set Package Version
run: |
echo "PACKAGE_VERSION=$(cat package.json | jq .version -r)" >> $GITHUB_ENV
- name: Create deb package
uses: jiro4989/build-deb-action@v3
with:
package: sesame-daemon
package_root: .debpkg
maintainer: Libertech-FR
version: ${{ env.PACKAGE_VERSION }} # ${{ github.ref }} # refs/tags/v*.*.*
arch: 'amd64'
desc: 'Sesame Daemon'
- name: Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: sesame-daemon*
tag: ${{ env.NEW_VERSION }}
overwrite: true
file_glob: true