Update .gitea/workflows/build.yml
This commit is contained in:
parent
916702b7ca
commit
7d70117e8c
@ -1,54 +1,61 @@
|
|||||||
name: Build
|
name: Build & Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*' # Only run for version tags
|
||||||
pull_request:
|
|
||||||
branches: [ master ]
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Setup .NET
|
- name: Setup .NET
|
||||||
uses: actions/setup-dotnet@v3
|
uses: actions/setup-dotnet@v3
|
||||||
with:
|
with:
|
||||||
dotnet-version: '9.0.x'
|
dotnet-version: '9.0.x'
|
||||||
|
|
||||||
- name: Restore dependencies
|
- name: Build & Package
|
||||||
run: dotnet restore FireflyClient.sln
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: |
|
run: |
|
||||||
chmod +x build-all.sh
|
dotnet publish -c Release -o artifacts/release
|
||||||
./build-all.sh
|
mkdir -p artifacts/packages
|
||||||
|
cd artifacts/release
|
||||||
|
zip -r ../packages/firefly-${GITHUB_REF#refs/tags/}.zip .
|
||||||
|
|
||||||
- name: Verify artifacts
|
- name: Extract Tag Name
|
||||||
run: |
|
run: |
|
||||||
ls -la artifacts/exe || echo "No exe artifacts found"
|
TAG_NAME="${GITHUB_REF#refs/tags/}"
|
||||||
ls -la artifacts/native || echo "No native artifacts found"
|
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Create Release in Gitea
|
||||||
if: ${{ !env.ACT }}
|
run: |
|
||||||
uses: actions/upload-artifact@v3
|
RELEASE_DATA=$(curl -s -X POST "${GITEA_URL}/api/v1/repos/${GITEA_REPO}/releases" \
|
||||||
with:
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
name: firefly-artifacts
|
-H "Content-Type: application/json" \
|
||||||
path: |
|
-d "{
|
||||||
artifacts/exe
|
\"tag_name\": \"${TAG_NAME}\",
|
||||||
artifacts/native
|
\"name\": \"Release ${TAG_NAME}\",
|
||||||
|
\"body\": \"Automated release for ${TAG_NAME}\",
|
||||||
|
\"draft\": false,
|
||||||
|
\"prerelease\": false
|
||||||
|
}")
|
||||||
|
|
||||||
- name: Create Release
|
echo "Release created: $RELEASE_DATA"
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
RELEASE_ID=$(echo "$RELEASE_DATA" | jq '.id')
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
with:
|
if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "null" ]; then
|
||||||
files: |
|
echo "Failed to retrieve release ID. Exiting."
|
||||||
artifacts/exe/**
|
exit 1
|
||||||
artifacts/native/**
|
fi
|
||||||
generate_release_notes: true
|
|
||||||
|
curl -X POST "${GITEA_URL}/api/v1/repos/${GITEA_REPO}/releases/${RELEASE_ID}/assets?name=firefly-${TAG_NAME}.zip" \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/zip" \
|
||||||
|
--data-binary @artifacts/packages/firefly-${TAG_NAME}.zip
|
||||||
|
|
||||||
|
env:
|
||||||
|
GITEA_URL: https://gitea.innovativedevsolutions.org
|
||||||
|
GITEA_REPO: IDSolutions/fireflyclient
|
||||||
|
GITEA_TOKEN: ${{ secrets.NET_TOKEN }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user