-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (120 loc) · 4.42 KB
/
releases.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
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
name: Release
on:
pull_request:
types: [closed]
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
outputs:
APP_VERSION: ${{ steps.generate_tag.outputs.new_tag }}
steps:
- name: Generate a token
id: generate_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}
- name: Bump version and generate tag (dry run)
id: generate_tag
uses: anothrNick/github-tag-action@1.67.0
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
WITH_V: false
DRY_RUN: true
- name: Update version in package.json
run: |
echo "Updating package.json version to ${{ steps.generate_tag.outputs.new_tag }}"
sed -i "s/\"version\": \".*\"/\"version\": \"${{ steps.generate_tag.outputs.new_tag }}\"/" package.json
- name: Commit version bump
run: |
git config user.name "paramo-bot"
git config user.email "150099564+paramo-bot[bot]@users.noreply.github.com"
git add package.json
git commit -m "chore: update project version to ${{ steps.generate_tag.outputs.new_tag }}"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ steps.generate_token.outputs.token }}
- name: Bump version and push tag
id: create_tag
uses: anothrNick/github-tag-action@1.67.0
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
WITH_V: false
- name: Publish release
uses: softprops/action-gh-release@v0.1.15
with:
prerelease: true
generate_release_notes: true
tag_name: ${{ steps.create_tag.outputs.new_tag }}
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
- name: Set vars for next job
run: |
echo "APP_VERSION=${{ steps.generate_tag.outputs.new_tag }}" >> $GITHUB_OUTPUT
upload-release-assets:
needs: release
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-12, windows-2022]
include:
- os: windows-2022
ext_glob: "exe"
- os: macos-12
ext_glob: "dmg"
- os: ubuntu-latest
ext_glob: "+(deb|AppImage)"
runs-on: ${{ matrix.os }}
steps:
- name: Generate a token
id: generate_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}
ref: ${{ needs.release.outputs.APP_VERSION }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.15.0'
- name: Install pnpm
id: setup-pnpm
uses: pnpm/action-setup@v3
- name: Set pnpm version
if: matrix.os == 'windows-2022'
run: echo "PNPM_VERSION=$(pnpm --version)" >> $env:GITHUB_ENV
- name: Set pnpm.cjs path
if: matrix.os == 'windows-2022'
env:
PNPM_PATH: ${{ steps.setup-pnpm.outputs.dest }}
PNPM_FIRST_HALF: /node_modules/.pnpm/pnpm@
PNPM_SECOND_HALF: /node_modules/pnpm/bin/pnpm.cjs
run: |
echo "PNPM_CJS=${{ env.PNPM_PATH }}${{ env.PNPM_FIRST_HALF }}${{ env.PNPM_VERSION }}${{ env.PNPM_SECOND_HALF }}" >> $env:GITHUB_ENV
- name: Fix pnpm.cjs
if: matrix.os == 'windows-2022'
run: |
echo "PNPM_CJS: ${{ env.PNPM_CJS }}"
sed -i 's/#!\/usr\/bin\/env node/#!node/' ${{ env.PNPM_CJS }}
cat ${{ env.PNPM_CJS }}
- name: Build electron
run: pnpm electron:build
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ steps.generate_token.outputs.token }}
file: builds/${{ needs.release.outputs.APP_VERSION }}/pmca-manuel-${{ needs.release.outputs.APP_VERSION }}.${{ matrix.ext_glob }}
tag: ${{ needs.release.outputs.APP_VERSION }}
overwrite: true
file_glob: true