Build configs edit
This commit is contained in:
118
.gitea/workflows/release.yml
Normal file
118
.gitea/workflows/release.yml
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
name: Build release binaries
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
BINARY_NAME: streamed-tui
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- goos: linux
|
||||||
|
goarch: amd64
|
||||||
|
archive: tar.gz
|
||||||
|
extension: ""
|
||||||
|
- goos: linux
|
||||||
|
goarch: arm64
|
||||||
|
archive: tar.gz
|
||||||
|
extension: ""
|
||||||
|
- goos: windows
|
||||||
|
goarch: amd64
|
||||||
|
archive: zip
|
||||||
|
extension: ".exe"
|
||||||
|
- goos: darwin
|
||||||
|
goarch: amd64
|
||||||
|
archive: tar.gz
|
||||||
|
extension: ""
|
||||||
|
- goos: darwin
|
||||||
|
goarch: arm64
|
||||||
|
archive: tar.gz
|
||||||
|
extension: ""
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
|
cache: true
|
||||||
|
|
||||||
|
- name: Build ${{ matrix.goos }} ${{ matrix.goarch }} binary
|
||||||
|
env:
|
||||||
|
GOOS: ${{ matrix.goos }}
|
||||||
|
GOARCH: ${{ matrix.goarch }}
|
||||||
|
CGO_ENABLED: 0
|
||||||
|
EXTENSION: ${{ matrix.extension }}
|
||||||
|
run: |
|
||||||
|
mkdir -p dist
|
||||||
|
OUTPUT="${BINARY_NAME}${EXTENSION}"
|
||||||
|
go build -o "dist/${OUTPUT}" .
|
||||||
|
|
||||||
|
- name: Package artifact
|
||||||
|
env:
|
||||||
|
EXTENSION: ${{ matrix.extension }}
|
||||||
|
run: |
|
||||||
|
cd dist
|
||||||
|
OUTPUT="${BINARY_NAME}${EXTENSION}"
|
||||||
|
ARCHIVE="${BINARY_NAME}_${{ matrix.goos }}_${{ matrix.goarch }}"
|
||||||
|
if [ "${{ matrix.archive }}" = "zip" ]; then
|
||||||
|
zip "${ARCHIVE}.zip" "${OUTPUT}"
|
||||||
|
else
|
||||||
|
tar -czf "${ARCHIVE}.tar.gz" "${OUTPUT}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Upload build artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: ${{ env.BINARY_NAME }}_${{ matrix.goos }}_${{ matrix.goarch }}
|
||||||
|
path: dist/${{ env.BINARY_NAME }}_${{ matrix.goos }}_${{ matrix.goarch }}.*
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: dist
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
|
- name: Publish release assets on GitHub
|
||||||
|
if: startsWith(github.server_url, 'https://github.com')
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
files: dist/*
|
||||||
|
|
||||||
|
- name: Publish release assets on Gitea
|
||||||
|
if: startsWith(github.server_url, 'https://github.com') == false
|
||||||
|
env:
|
||||||
|
API_URL: ${{ github.api_url }}
|
||||||
|
REPOSITORY: ${{ github.repository }}
|
||||||
|
RELEASE_ID: ${{ github.event.release.id }}
|
||||||
|
TOKEN: ${{ secrets.CI_TOKEN || secrets.GITHUB_TOKEN || github.token }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
shopt -s nullglob
|
||||||
|
for file in dist/*; do
|
||||||
|
name=$(basename "${file}")
|
||||||
|
curl -sfSL -X POST \
|
||||||
|
-H "Authorization: token ${TOKEN}" \
|
||||||
|
-H "Content-Type: application/octet-stream" \
|
||||||
|
--data-binary @"${file}" \
|
||||||
|
"${API_URL}/repos/${REPOSITORY}/releases/${RELEASE_ID}/assets?name=${name}"
|
||||||
|
done
|
||||||
|
shell: bash
|
||||||
118
.github/workflows/release.yml
vendored
Normal file
118
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
name: Build release binaries
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
BINARY_NAME: streamed-tui
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- goos: linux
|
||||||
|
goarch: amd64
|
||||||
|
archive: tar.gz
|
||||||
|
extension: ""
|
||||||
|
- goos: linux
|
||||||
|
goarch: arm64
|
||||||
|
archive: tar.gz
|
||||||
|
extension: ""
|
||||||
|
- goos: windows
|
||||||
|
goarch: amd64
|
||||||
|
archive: zip
|
||||||
|
extension: ".exe"
|
||||||
|
- goos: darwin
|
||||||
|
goarch: amd64
|
||||||
|
archive: tar.gz
|
||||||
|
extension: ""
|
||||||
|
- goos: darwin
|
||||||
|
goarch: arm64
|
||||||
|
archive: tar.gz
|
||||||
|
extension: ""
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
|
cache: true
|
||||||
|
|
||||||
|
- name: Build ${{ matrix.goos }} ${{ matrix.goarch }} binary
|
||||||
|
env:
|
||||||
|
GOOS: ${{ matrix.goos }}
|
||||||
|
GOARCH: ${{ matrix.goarch }}
|
||||||
|
CGO_ENABLED: 0
|
||||||
|
EXTENSION: ${{ matrix.extension }}
|
||||||
|
run: |
|
||||||
|
mkdir -p dist
|
||||||
|
OUTPUT="${BINARY_NAME}${EXTENSION}"
|
||||||
|
go build -o "dist/${OUTPUT}" .
|
||||||
|
|
||||||
|
- name: Package artifact
|
||||||
|
env:
|
||||||
|
EXTENSION: ${{ matrix.extension }}
|
||||||
|
run: |
|
||||||
|
cd dist
|
||||||
|
OUTPUT="${BINARY_NAME}${EXTENSION}"
|
||||||
|
ARCHIVE="${BINARY_NAME}_${{ matrix.goos }}_${{ matrix.goarch }}"
|
||||||
|
if [ "${{ matrix.archive }}" = "zip" ]; then
|
||||||
|
zip "${ARCHIVE}.zip" "${OUTPUT}"
|
||||||
|
else
|
||||||
|
tar -czf "${ARCHIVE}.tar.gz" "${OUTPUT}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Upload build artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: ${{ env.BINARY_NAME }}_${{ matrix.goos }}_${{ matrix.goarch }}
|
||||||
|
path: dist/${{ env.BINARY_NAME }}_${{ matrix.goos }}_${{ matrix.goarch }}.*
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: dist
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
|
- name: Publish release assets on GitHub
|
||||||
|
if: startsWith(github.server_url, 'https://github.com')
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
files: dist/*
|
||||||
|
|
||||||
|
- name: Publish release assets on Gitea
|
||||||
|
if: startsWith(github.server_url, 'https://github.com') == false
|
||||||
|
env:
|
||||||
|
API_URL: ${{ github.api_url }}
|
||||||
|
REPOSITORY: ${{ github.repository }}
|
||||||
|
RELEASE_ID: ${{ github.event.release.id }}
|
||||||
|
TOKEN: ${{ secrets.CI_TOKEN || secrets.GITHUB_TOKEN || github.token }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
shopt -s nullglob
|
||||||
|
for file in dist/*; do
|
||||||
|
name=$(basename "${file}")
|
||||||
|
curl -sfSL -X POST \
|
||||||
|
-H "Authorization: token ${TOKEN}" \
|
||||||
|
-H "Content-Type: application/octet-stream" \
|
||||||
|
--data-binary @"${file}" \
|
||||||
|
"${API_URL}/repos/${REPOSITORY}/releases/${RELEASE_ID}/assets?name=${name}"
|
||||||
|
done
|
||||||
|
shell: bash
|
||||||
Reference in New Issue
Block a user