fix(ci): correct install deps and push release
This commit is contained in:
@@ -4,6 +4,8 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build-backend:
|
||||
@@ -14,7 +16,9 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: apk add --no-cache go gcc musl-dev libpcap-dev
|
||||
run: |
|
||||
sed -i 's|https://dl-cdn.alpinelinux.org|http://dl-cdn.alpinelinux.org|g' /etc/apk/repositories
|
||||
apk add --no-cache go gcc musl-dev libpcap-dev
|
||||
|
||||
- name: Download modules
|
||||
run: go mod download
|
||||
@@ -43,7 +47,10 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: apk add --no-cache nodejs npm && npm install
|
||||
run: |
|
||||
sed -i 's|https://dl-cdn.alpinelinux.org|http://dl-cdn.alpinelinux.org|g' /etc/apk/repositories
|
||||
apk add --no-cache nodejs npm
|
||||
npm install
|
||||
|
||||
- name: Build
|
||||
run: npm run generate
|
||||
@@ -57,3 +64,53 @@ jobs:
|
||||
|
||||
- name: Clean up
|
||||
run: rm -rf .output/
|
||||
|
||||
release:
|
||||
name: Create Release
|
||||
runs-on: host-runner
|
||||
needs: [build-backend, build-frontend]
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
steps:
|
||||
- name: Install curl
|
||||
run: |
|
||||
sed -i 's|https://dl-cdn.alpinelinux.org|http://dl-cdn.alpinelinux.org|g' /etc/apk/repositories
|
||||
apk add --no-cache curl
|
||||
|
||||
- name: Download backend artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ids-backend
|
||||
path: release/
|
||||
|
||||
- name: Download frontend artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ids-frontend
|
||||
path: release/frontend/
|
||||
|
||||
- name: Pack frontend
|
||||
run: tar -czf release/ids-frontend.tar.gz -C release/frontend .
|
||||
|
||||
- name: Create release and upload assets
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
TAG="${{ github.ref_name }}"
|
||||
REPO="${{ github.repository }}"
|
||||
SERVER="${{ github.server_url }}"
|
||||
|
||||
RELEASE_ID=$(curl -sf -X POST \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\":\"${TAG}\",\"name\":\"Release ${TAG}\"}" \
|
||||
"${SERVER}/api/v1/repos/${REPO}/releases" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||
|
||||
curl -sf -X POST \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-F "attachment=@release/ids" \
|
||||
"${SERVER}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets"
|
||||
|
||||
curl -sf -X POST \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-F "attachment=@release/ids-frontend.tar.gz" \
|
||||
"${SERVER}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets"
|
||||
|
||||
Reference in New Issue
Block a user