forked from ashimov/vyos-build-action
-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (78 loc) · 2.78 KB
/
vyos-v1.4-lts-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
name: VyOS v1.4 LTS Release
permissions:
contents: write
on:
workflow_dispatch:
env:
GIT_CLONE_URL: https://github.com/vyos/vyos-build
BRANCH: sagitta
ARCHITECTURE: amd64
BUILD_BY: [email protected]
BUILD_TYPE: release
VERSION: 1.4.0-20240621
DEBIAN_MIRROR: http://ftp.us.debian.org/debian/
VYOS_MIRROR: http://5.63.112.27/sagitta
APT_KEY_URL: http://5.63.112.27/apt.gpg.key
jobs:
build:
runs-on: ubuntu-latest
container:
image: vyos/vyos-build:sagitta
options: --workdir /vyos --privileged
steps:
- name: Clone source code
run: git clone -b $BRANCH --single-branch $GIT_CLONE_URL
- name: Download APT key
run: |
mkdir -p /vyos/apt-keys
wget -O /vyos/apt-keys/apt.gpg.key $APT_KEY_URL
- name: Build ISO
working-directory: ./vyos-build
run: |
sudo make clean
sudo ./build-vyos-image iso --architecture $ARCHITECTURE --build-by $BUILD_BY --build-type $BUILD_TYPE --version $VERSION --vyos-mirror $VYOS_MIRROR --custom-apt-key /vyos/apt-keys/apt.gpg.key
- name: Debug build directory
run: ls -R ./vyos-build/build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: vyos-${{ env.VERSION }}-${{ env.ARCHITECTURE }}-iso
path: vyos-build/build/vyos-${{ env.VERSION }}-*.iso
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: vyos-${{ env.VERSION }}-${{ env.ARCHITECTURE }}-iso
path: vyos-${{ env.VERSION }}-${{ env.ARCHITECTURE }}-iso
- name: Debug download directory
run: ls -R ./vyos-${{ env.VERSION }}-${{ env.ARCHITECTURE }}-iso
- name: Create GitHub release if it doesn't exist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag_name="v${{ env.VERSION }}"
release_name="VyOS ${tag_name} Release"
if ! gh release view "$tag_name" >/dev/null 2>&1; then
gh release create "$tag_name" --title "$release_name" --notes "Release notes for VyOS $tag_name"
fi
- name: Upload release asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
asset=$(find ./vyos-${{ env.VERSION }}-${{ env.ARCHITECTURE }}-iso/ -name "vyos-${{ env.VERSION }}-*.iso" | xargs)
echo "Found asset: $asset"
tag_name="v${{ env.VERSION }}"
gh release upload "$tag_name" "$asset"
delete_old_workflow_runs:
needs: release
runs-on: ubuntu-latest
steps:
- name: Delete old workflow runs
uses: GitRML/delete-workflow-runs@main
with:
retain_days: 31