cordle/.gitea/workflows/release.yml
Gregory Gauthier beda41fdef
All checks were successful
Build / build (push) Successful in 13s
Release / release (push) Successful in 15s
attempt to use the API before installing Go
2026-02-02 11:55:29 +00:00

65 lines
2.1 KiB
YAML

name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-gitea
steps:
- name: Prep For Local Builds
run: echo "${LOCIP} gitea.comnenos" >> /etc/hosts
- uses: actions/checkout@v4
- name: Install Build Tools
run: |
apt update
apt -y --no-install-recommends install build-essential gcc make
- name: Build
run: make all
- name: Create Release Archive
run: |
VERSION=${GITHUB_REF#refs/tags/}
mkdir -p release
tar -czf release/cordle-${VERSION}-linux-amd64.tar.gz -C build cordle WORDS
cd release
sha256sum cordle-${VERSION}-linux-amd64.tar.gz > cordle-${VERSION}-linux-amd64.tar.gz.sha256
ls cordle-${VERSION}-linux-amd64.tar.gz* # For debugging
- name: Create Release
env:
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: |
VERSION=${GITHUB_REF#refs/tags/}
# Create release
curl -X POST "https://repos.gmgauthier.com/api/v1/repos/${GITHUB_REPOSITORY}/releases" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d "{
\"tag_name\": \"${VERSION}\",
\"name\": \"Cordle ${VERSION}\",
\"body\": \"Release ${VERSION}\"
}" > release_response.json
RELEASE_ID=$(cat release_response.json | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2)
# Upload tarball
curl -X POST "https://repos.gmgauthier.com/api/v1/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=cordle-${VERSION}-linux-amd64.tar.gz" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/gzip" \
--data-binary @release/cordle-${VERSION}-linux-amd64.tar.gz
# Upload checksum
curl -X POST "https://repos.gmgauthier.com/api/v1/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=cordle-${VERSION}-linux-amd64.tar.gz.sha256" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: text/plain" \
--data-binary @release/cordle-${VERSION}-linux-amd64.tar.gz.sha256