-
Notifications
You must be signed in to change notification settings - Fork 11
140 lines (133 loc) · 4.22 KB
/
devel_release_firmware.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: devel_release_firmware
on:
push:
paths:
- 'trigger_devel.txt'
# Ensures that only one deploy task per branch/environment will run at a time.
concurrency:
group: environment-${{ github.ref }}
cancel-in-progress: false
jobs:
save_repo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: firmware
- name: Save repo as artifact
run: |
rsync -avR ./ artifact
rm -rf artifact/.git
- name: Upload repo as artifact
uses: actions/upload-artifact@v3
with:
name: firmware
path: artifact
empty_branch:
needs: save_repo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: firmware
- name: Create new empty firmware branch
run: |
git config --global user.email github-actions@github.com
git config --global user.name github-actions
git switch --orphan new_branch # create empty branch
git commit --allow-empty -m "Initial commit"
git push -u origin new_branch # push empty branch in repo
git switch firmware
git reset --hard new_branch # reset firmware branch
git push origin firmware -f
git push origin --delete new_branch # delete empty_branch
release_restore:
needs: empty_branch
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.MASTER_ACCESS_TOKEN }}
ref: firmware
- name: Download repo artifact
uses: actions/download-artifact@v3
with:
name: firmware
path: artifact
- name: Display structure of downloaded files
run: |
ls -R
- name: Move files back
run: |
rsync -avR artifact/./ ./
rm -rf artifact
rm tag_latest.txt 2> /dev/null || echo > /dev/null
- name: Build Tag and commit message
run: |
tas_com_tmp1=$(curl https://raw.githubusercontent.com/arendst/tmp_copy/action-development/trigger.txt)
tas_com_tmp="Based on https://github.com/arendst/Tasmota/commit/${tas_com_tmp1}"
tag_name_tmp="$(date -I).d.$tas_com_tmp1"
echo "$tas_com_tmp" >> release-info.txt
echo "$tag_name_tmp" >> tag_latest.txt
echo "$tag_name_tmp" >> tag.txt
echo "tas_com=$tas_com_tmp" >> $GITHUB_ENV
echo "tag_name=$tag_name_tmp" >> $GITHUB_ENV
- name: Update Manifest files
run: |
mkdir manifest_release
python genManifest.py
python genManifestWithFeatureas.py
python genManifestRelease.py
- name: Release devel firmwares
uses: jason2866/action-gh-release@v1.2
with:
tag_name: ${{ env.tag_name }}
body_path: release-info.txt
prerelease: true
files: |
tag_latest.txt
tag.txt
manifests_release.json
manifest_release/development*
manifest_release/unofficial*
firmware/development/*
firmware/unofficial/*
env:
GITHUB_TOKEN: ${{ secrets.MASTER_ACCESS_TOKEN }}
- name: Remove not needed files stored in repo
run: |
rm -rf release-info.txt
rm -rf manifests_release.json
rm -rf manifest_release
- name: Push artifact content in branch firmware
run: |
git config user.email github-actions@github.com
git config user.name "github-actions"
git add -A
git commit --allow-empty -m "${{ env.tas_com }}"
git push origin firmware -f
deploy:
needs: release_restore
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: firmware
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
# Upload entire repository
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1