-
Notifications
You must be signed in to change notification settings - Fork 12
158 lines (132 loc) · 5.36 KB
/
update-build-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
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
155
156
157
name: Update, build and release
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
push:
branches:
- 'master'
- 'dev'
jobs:
update_packages:
runs-on: ubuntu-latest
container:
image: archlinux:latest
steps:
- name: Install dependencies
run: pacman -Syy -q --noconfirm && pacman -S -q --noconfirm git jq nix python python-requests openssl gcc-libs glibc
- name: Checkout
uses: actions/checkout@v4
- name: Git Access Fix
run: git config --global --add safe.directory "*"
- name: Update package files
run: |
python utility/update_version.py
python utility/generate_packages.py
- name: Commit and push changes
uses: EndBug/[email protected]
id: commit
with:
message: Update packages
add: "."
author_name: GitHub Actions
author_email: [email protected]"
- name: Get Version
id: version
run: |
VERSION=$(jq -r '.ym.version' ./utility/version_info.json)
release_name="v$VERSION"
tag_name="v$VERSION"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "release_name=$release_name" >> $GITHUB_OUTPUT
echo "tag_name=$tag_name" >> $GITHUB_OUTPUT
- name: Tag Repo
uses: rickstaa/action-create-tag@v1
with:
tag: ${{ steps.version.outputs.tag_name }}
force_push_tag: true
commit_sha: ${{ steps.commit.outputs.commit_long_sha || github.event.head_commit.id}}
- name: Outputs
id: outputs
run: |
echo "commited=${{ steps.commit.outputs.commited || github.event.head_commit }}" >> $GITHUB_OUTPUT
echo "commit_long_sha=${{ steps.commit.outputs.commit_long_sha || github.event.head_commit.id}}" >> $GITHUB_OUTPUT
echo "commit_name=${{ github.event.head_commit.message || 'Update packages' }}" >> $GITHUB_OUTPUT
echo "tag_name=${{ steps.version.outputs.tag_name }}" >> $GITHUB_OUTPUT
echo "release_name=${{ steps.version.outputs.release_name }}" >> $GITHUB_OUTPUT
echo "VERSION=${{ steps.version.outputs.VERSION }}" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
outputs:
commited: ${{ steps.outputs.outputs.commited != '' }}
commit_long_sha: ${{ steps.outputs.outputs.commit_long_sha }}
commit_name: ${{ steps.outputs.outputs.commit_name }}
tag_name: ${{ steps.outputs.outputs.tag_name }}
release_name: ${{ steps.outputs.outputs.release_name }}
version: ${{ steps.outputs.outputs.VERSION }}
build:
needs: [update_packages]
uses: ./.github/workflows/build.yml
if: ${{ needs.update_packages.outputs.commited }}
with:
ref: ${{ needs.update_packages.outputs.commit_long_sha }}
upload-release:
needs: [build, update_packages]
if: ${{ needs.update_packages.outputs.commited && github.ref_name == 'master' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.update_packages.outputs.commit_long_sha }}
- name: Publish package changes to AUR
uses: KSXGitHub/[email protected]
with:
pkgname: "yandex-music"
pkgbuild: "PKGBUILD"
updpkgsums: false
allow_empty_commits: true
commit_username: "cucumber-sp"
commit_email: "[email protected]"
ssh_private_key: "${{ secrets.AUR_SSH_PRIVATE_KEY }}"
commit_message: "${{ needs.update_packages.outputs.commit_name }}"
ssh_keyscan_types: "rsa,ecdsa,ed25519"
- name: Download artifact
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: dist
- name: Install packages
run: |
sudo apt-get update -y
sudo apt-get install jq -y
- name: Copy files to APT server
uses: appleboy/[email protected]
with:
host: ${{ secrets.CLOUD_SSH_HOST }}
username: ${{ secrets.CLOUD_SSH_USERNAME }}
password: ${{ secrets.CLOUD_SSH_PASSWORD }}
source: "dist/*.deb"
target: ~/apt/repo/deb-packages
rm: true
strip_components: 1
- name: Update APT repo
uses: appleboy/[email protected]
with:
host: ${{ secrets.CLOUD_SSH_HOST }}
username: ${{ secrets.CLOUD_SSH_USERNAME }}
password: ${{ secrets.CLOUD_SSH_PASSWORD }}
script: ~/apt/update-repo.sh
- name: Get Release Notes HTML
id: release_notes
run: echo "release_html=$(jq -r --arg version "${{ needs.update_packages.outputs.version }}" '.["desktop-release-notes." + $version]' ./dist/release_notes.json)" >> $GITHUB_OUTPUT
- run: rm -rf dist/release_notes.json
- name: Upload files to a GitHub release
uses: ncipollo/[email protected]
with:
allowUpdates: true
artifacts: dist/*
makeLatest: true
name: ${{ needs.update_packages.outputs.release_name }}
replacesArtifacts: true
tag: ${{ needs.update_packages.outputs.tag_name }}
body: ${{ steps.release_notes.outputs.release_html }}