2025-03-24 16:12:29 +01:00
|
|
|
name: Build iso when a new version is pushed
|
|
|
|
|
run-name: iso building
|
2025-04-16 14:57:32 +02:00
|
|
|
on:
|
|
|
|
|
push:
|
|
|
|
|
branches:
|
2026-02-07 16:14:03 +01:00
|
|
|
- 'iso'
|
2025-03-24 16:12:29 +01:00
|
|
|
|
|
|
|
|
jobs:
|
2025-03-24 19:00:12 +01:00
|
|
|
test:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
steps:
|
|
|
|
|
- name: get repo
|
|
|
|
|
uses: actions/checkout@v4.2.2
|
2025-04-15 15:18:41 +02:00
|
|
|
|
2025-04-15 15:54:01 +02:00
|
|
|
- name: install nix
|
2025-04-15 15:15:55 +02:00
|
|
|
uses: https://github.com/cachix/install-nix-action@v31
|
2025-04-15 15:21:28 +02:00
|
|
|
|
2025-04-15 19:46:47 +02:00
|
|
|
- name: install go
|
|
|
|
|
uses: https://github.com/actions/setup-go@v4
|
2025-04-15 19:47:58 +02:00
|
|
|
with:
|
|
|
|
|
go-version: '>=1.20.1'
|
2025-04-15 19:46:47 +02:00
|
|
|
|
2025-04-16 02:25:19 +02:00
|
|
|
- name: build iso
|
|
|
|
|
run: make iso
|
2025-04-15 19:54:43 +02:00
|
|
|
|
2025-04-15 20:01:32 +02:00
|
|
|
- name: get commit tag
|
2025-04-15 20:00:48 +02:00
|
|
|
id: vars
|
|
|
|
|
run: echo "TAG=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
|
|
- name: create tag
|
2025-04-15 19:54:43 +02:00
|
|
|
run: |
|
2025-04-15 20:06:46 +02:00
|
|
|
git config user.name "gitea-actions"
|
|
|
|
|
git config user.email "actions@gitea.com"
|
2025-04-15 20:00:48 +02:00
|
|
|
git tag ${{steps.vars.outputs.TAG}}
|
|
|
|
|
git push origin ${{steps.vars.outputs.TAG}}
|
2025-03-24 19:00:12 +01:00
|
|
|
|
|
|
|
|
- name: create release
|
2025-04-16 02:16:54 +02:00
|
|
|
run: |
|
|
|
|
|
AUTH_TOKEN=${{secrets.RELEASE_TOKEN}}
|
|
|
|
|
TAG_NAME=${{steps.vars.outputs.TAG}}
|
|
|
|
|
owner=tom
|
|
|
|
|
repo=nix-config
|
|
|
|
|
set -e
|
2025-04-16 02:22:56 +02:00
|
|
|
release_create_res=$(curl -X POST -H "Authorization: token $AUTH_TOKEN" -H "content-type: application/json" -d "{\"tag_name\":\"$TAG_NAME\",\"name\":\"$TAG_NAME\"}" "https://git.tmoron.fr/api/v1/repos/$owner/$repo/releases" 2>/dev/null)
|
2025-04-16 02:16:54 +02:00
|
|
|
|
|
|
|
|
release_id=$(echo $release_create_res | jq -r .id)
|
|
|
|
|
echo $release_id
|
|
|
|
|
|
|
|
|
|
if [ $release_id == "null" ]; then
|
|
|
|
|
echo error
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
file_send_res=$(curl \
|
2025-04-16 02:25:19 +02:00
|
|
|
"https://git.tmoron.fr/api/v1/repos/$owner/$repo/releases/$release_id/assets?name=nixos.iso"\
|
2025-04-16 02:16:54 +02:00
|
|
|
-H "Authorization: token $AUTH_TOKEN"\
|
|
|
|
|
-H "accept: application/json"\
|
|
|
|
|
-H "Content-Type: multipart/form-data"\
|
2025-04-16 02:25:19 +02:00
|
|
|
-F "attachment=@nixos.iso" 2>/dev/null)
|
2025-04-16 02:16:54 +02:00
|
|
|
echo $file_send_res
|