ci: fix working-directory and use internal Forgejo URL for git clone
Some checks failed
release / build-and-release (push) Failing after 1s
Some checks failed
release / build-and-release (push) Failing after 1s
This commit is contained in:
parent
bc9184345d
commit
2df894006f
1 changed files with 16 additions and 10 deletions
|
|
@ -16,11 +16,20 @@ jobs:
|
||||||
build-and-release:
|
build-and-release:
|
||||||
# Runner label 'ubuntu-latest' maps to golang:1.23-alpine container (see runner config)
|
# Runner label 'ubuntu-latest' maps to golang:1.23-alpine container (see runner config)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: /repo
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Setup
|
||||||
|
working-directory: /
|
||||||
# Go is pre-installed in golang:1.23-alpine container – no setup-go needed
|
run: |
|
||||||
|
apk add --no-cache git curl jq
|
||||||
|
git clone --depth=1 \
|
||||||
|
"http://x9:${{ secrets.FORGEJO_TOKEN }}@xetup-forgejo:3000/${{ github.repository }}.git" \
|
||||||
|
/repo
|
||||||
|
cd /repo
|
||||||
|
git checkout "${{ github.sha }}"
|
||||||
|
|
||||||
- name: Build xetup.exe
|
- name: Build xetup.exe
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -30,14 +39,12 @@ jobs:
|
||||||
- name: Publish latest release
|
- name: Publish latest release
|
||||||
env:
|
env:
|
||||||
TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
||||||
API: ${{ github.server_url }}/api/v1
|
API: http://xetup-forgejo:3000/api/v1
|
||||||
REPO: ${{ github.repository }}
|
REPO: ${{ github.repository }}
|
||||||
run: |
|
run: |
|
||||||
apk add --no-cache curl jq
|
SHORT=$(echo "${{ github.sha }}" | cut -c1-7)
|
||||||
|
|
||||||
SHORT=$(echo "$GITHUB_SHA" | cut -c1-7)
|
# Delete existing 'latest' release and tag to recreate cleanly
|
||||||
|
|
||||||
# Delete existing 'latest' release (and its tag) to recreate cleanly
|
|
||||||
RID=$(curl -sf -H "Authorization: token $TOKEN" \
|
RID=$(curl -sf -H "Authorization: token $TOKEN" \
|
||||||
"$API/repos/$REPO/releases/tags/latest" | jq -r '.id // empty')
|
"$API/repos/$REPO/releases/tags/latest" | jq -r '.id // empty')
|
||||||
if [ -n "$RID" ]; then
|
if [ -n "$RID" ]; then
|
||||||
|
|
@ -55,7 +62,7 @@ jobs:
|
||||||
-d "{\"tag_name\":\"latest\",\"name\":\"latest\",\"body\":\"Auto-built from ${SHORT}\",\"prerelease\":true}" \
|
-d "{\"tag_name\":\"latest\",\"name\":\"latest\",\"body\":\"Auto-built from ${SHORT}\",\"prerelease\":true}" \
|
||||||
| jq -r '.id')
|
| jq -r '.id')
|
||||||
|
|
||||||
# Upload xetup.exe as release asset
|
# Upload xetup.exe
|
||||||
curl -sf -X POST \
|
curl -sf -X POST \
|
||||||
-H "Authorization: token $TOKEN" \
|
-H "Authorization: token $TOKEN" \
|
||||||
-H "Content-Type: application/octet-stream" \
|
-H "Content-Type: application/octet-stream" \
|
||||||
|
|
@ -63,4 +70,3 @@ jobs:
|
||||||
--data-binary @xetup.exe
|
--data-binary @xetup.exe
|
||||||
|
|
||||||
echo "Released xetup.exe (commit ${SHORT})"
|
echo "Released xetup.exe (commit ${SHORT})"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue