-
Notifications
You must be signed in to change notification settings - Fork 1
142 lines (137 loc) · 4.29 KB
/
create-release-from-a-tag.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
name: Publish
on:
workflow_dispatch:
push:
branches:
- 'main'
jobs:
build-x86:
permissions: write-all
name: Publish Image x86
runs-on: ubuntu-latest
strategy:
matrix:
BUILDTYPE: ["full","min"]
BUILDARCH: ["686","amd64"]
container:
image: debian:stable
options: --privileged
volumes:
- /dev:/dev
steps:
- name: Install Packages
shell: bash
run: |
apt-get -qqy update && apt-get -qqy install debootstrap coreutils dosfstools zip pigz fdisk kpartx mount uuid-runtime lvm2 git && git config --global --add safe.directory '*'
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Read release.md and use it as a body of new release
id: read_release
shell: bash
run: |
r=$(cat ./release.md)
r="${r//'%'/'%25'}"
r="${r//$'\n'/'%0A'}"
r="${r//$'\r'/'%0D'}"
echo "RELEASE_BODY=$r" >> $GITHUB_OUTPUT
- name: Build
id: build_bootable
env:
BUILDTYPE: ${{matrix.BUILDTYPE}}
BUILDARCH: ${{matrix.BUILDARCH}}
shell: bash
run: |
rm -f ./*.zip
bash ./create_image.sh
v=$(cat ./versions.txt)
v="${v//'%'/'%25'}"
v="${v//$'\n'/'%0A'}"
v="${v//$'\r'/'%0D'}"
echo "VERSIONS=$v" >> $GITHUB_OUTPUT
- name: Compress
id: compress
shell: bash
run: |
cd ./output
ls -altrh
basename=$(basename -s .img *.img)
zip -r ${basename}.zip ${basename}.*
- name: Bump version and push tag
id: bump_version
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # if you don't want to set write permissions use a PAT token
WITH_V: true
INITIAL_VERSION: 1.0.0
- name: Generate versions
id: versions
shell: bash
run: |
echo "release=${{ steps.read_release.outputs.RELEASE_BODY }}" >> $GITHUB_OUTPUT
echo "versions=${{ steps.build_bootable.outputs.VERSIONS }}" >> $GITHUB_OUTPUT
- name: Upload binaries to release
id: release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file_glob: true
file: ./output/*.zip
tag: ${{ steps.bump_version.outputs.new_tag }}
overwrite: true
body: |
${{join(steps.versions.outputs.*, '%0A')}}
#build-other:
# permissions: write-all
# name: Publish Image Other Arch
# runs-on: ubuntu-latest
# strategy:
# matrix:
# BUILDTYPE: ["full","min"]
# BUILDARCH: ["aarch64"]
# steps:
# - uses: actions/checkout@v4
# - name: Build
# uses: uraimo/run-on-arch-action@v2
# id: build_bootable
# with:
# arch: ${{matrix.BUILDARCH}}
# distro: ubuntu_latest
# # Create an artifacts directory
# setup: |
# mkdir -p "${PWD}/output"
# # Mount the artifacts directory as /artifacts in the container
# dockerRunArgs: |
# --volume "${PWD}/output:/output"
# env: |
# BUILDTYPE: ${{matrix.BUILDTYPE}}
# BUILDARCH: ${{matrix.BUILDARCH}}
# run: |
# uname -a
# apt-get -qqy update && apt-get -qqy install debootstrap coreutils pigz fdisk kpartx mount uuid-runtime lvm2 git sudo
# git config --global --add safe.directory ${PWD}
# bash ./create_image.sh
# cp -f ./output/* /output/.
# - name: Compress
# id: compress
# run: |
# apt-get -qqy update && apt-get -qqy install zip
# cd ./output
# basename=$(basename -s .img *.img)
# zip -r ${basename} *
# - name: Bump version and push tag
# id: bump_version
# uses: anothrNick/[email protected] # Don't use @master or @v1 unless you're happy to test the latest version
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # if you don't want to set write permissions use a PAT token
# WITH_V: true
# - name: Upload binaries to release
# id: release
# uses: svenstaro/upload-release-action@v2
# with:
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# file_glob: true
# file: ./output/*.zip
# tag: ${{ steps.bump_version.outputs.new_tag }}
# overwrite: true