Add build and release workflow of ParchLinux WSL
This commit is contained in:
parent
669b428504
commit
54054fb51a
1 changed files with 69 additions and 0 deletions
69
.forgejo/workflow/build-release.yml
Normal file
69
.forgejo/workflow/build-release.yml
Normal file
|
@ -0,0 +1,69 @@
|
|||
name: Build and Release of ParchLinux WSL Image
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: archlinux:base-devel
|
||||
options: --privileged
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
echo "Updating system packages..."
|
||||
pacman -Syu --noconfirm || { echo 'pacman update failed!'; exit 1; }
|
||||
echo "Installing necessary packages..."
|
||||
pacman -S --noconfirm \
|
||||
make \
|
||||
devtools \
|
||||
fakechroot \
|
||||
fakeroot \
|
||||
git \
|
||||
python \
|
||||
curl \
|
||||
base-devel || { echo 'pacman install failed!'; exit 1; }
|
||||
|
||||
- name: Build ParchLinux WSL image
|
||||
run: |
|
||||
echo "Building the ParchLinux WSL image..."
|
||||
make build || { echo 'Make build failed!'; exit 1; }
|
||||
|
||||
- name: Upload release artifact to Forgejo
|
||||
env:
|
||||
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
||||
FORGEJO_URL: https://src.panahifar.ir
|
||||
OWNER: ahp
|
||||
REPO: parchlinux-wsl
|
||||
run: |
|
||||
echo "Preparing to upload the artifact..."
|
||||
|
||||
# Find the latest .wsl file in the output directory dynamically
|
||||
ASSET=$(find /home/ahp/Documents/Developments/parchlinux-wsl/workdir/output -type f -name "*.wsl" | sort | tail -n 1)
|
||||
|
||||
# Check if the asset file exists
|
||||
if [ -z "$ASSET" ]; then
|
||||
echo "Error: No artifact found in the output directory!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get the tag from the GitHub release reference
|
||||
TAG=$(basename ${{ github.ref }})
|
||||
|
||||
echo "Uploading asset to Forgejo release..."
|
||||
|
||||
# Use curl to upload the artifact to Forgejo release
|
||||
curl -X POST \
|
||||
-H "Authorization: token $FORGEJO_TOKEN" \
|
||||
-H "Content-Type: multipart/form-data" \
|
||||
-F "name=$(basename $ASSET)" \
|
||||
-F "attachment=@$ASSET" \
|
||||
"$FORGEJO_URL/api/v1/repos/$OWNER/$REPO/releases/tags/$TAG/assets" || { echo 'Asset upload failed!'; exit 1; }
|
||||
|
||||
echo "Release artifact uploaded successfully!"
|
Loading…
Add table
Add a link
Reference in a new issue