...
This commit is contained in:
parent
fc5e30dda3
commit
643d1418ec
@ -20,7 +20,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y chafa libglib2.0-dev
|
||||
sudo apt-get install -y chafa libglib2.0-dev jq
|
||||
|
||||
- name: Build binary
|
||||
run: make build
|
||||
@ -32,25 +32,22 @@ jobs:
|
||||
run: |
|
||||
tar -czvf gogofetch-${{ github.ref_name }}-linux-amd64.tar.gz gogofetch Makefile logos/
|
||||
|
||||
- name: Create Release and Upload Asset
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
const assetName = `gogofetch-${context.ref.replace('refs/tags/', '')}-linux-amd64.tar.gz`;
|
||||
- name: Create Release and Upload Asset via API
|
||||
run: |
|
||||
TAG="${{ github.ref_name }}"
|
||||
REPO="${{ github.repository }}"
|
||||
TOKEN="${{ secrets.GITHUB_TOKEN }}"
|
||||
ASSET="gogofetch-${TAG}-linux-amd64.tar.gz"
|
||||
|
||||
const release = await github.rest.repos.createRelease({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
tag_name: context.ref.replace('refs/tags/', ''),
|
||||
name: `Release ${context.ref.replace('refs/tags/', '')}`,
|
||||
body: "Automated binary release for Arch Linux AUR"
|
||||
});
|
||||
RELEASE_ID=$(curl -X POST "${{ github.server_url }}/api/v1/repos/${REPO}/releases" \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\":\"${TAG}\",\"target_commitish\":\"master\",\"name\":\"Release ${TAG}\",\"body\":\"Automated binary release for Arch Linux AUR\",\"draft\":false,\"prerelease\":false}" \
|
||||
| jq '.id')
|
||||
|
||||
await github.rest.repos.uploadReleaseAsset({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
release_id: release.data.id,
|
||||
name: assetName,
|
||||
data: fs.readFileSync(`./${assetName}`)
|
||||
});
|
||||
echo "Created release with ID: ${RELEASE_ID}"
|
||||
|
||||
curl -X POST "${{ github.server_url }}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets" \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
-H "Accept: application/json" \
|
||||
-F "attachment=@./${ASSET}"
|
||||
Loading…
Reference in New Issue
Block a user