Fix archlinux mirror #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build release | |
on: | |
workflow_dispatch: | |
inputs: | |
asl_version: | |
description: "Optional: asl version to use as tag_name (leave blank to use the latest remote version)" | |
required: false | |
release_name: | |
description: "Optional: Custom release name (asl v* release)" | |
required: false | |
push: | |
branches: [ "main" ] | |
pull_request: | |
jobs: | |
check_update: | |
name: Check update | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check latest version | |
id: check_version | |
run: | | |
remote_version=$(curl -L https://api.github.com/repos/Moe-hacker/asl/releases/latest | jq -r .tag_name) | |
remote_name=$(curl -L https://api.github.com/repos/Moe-hacker/asl/releases/latest | jq -r .name) | |
echo "remote_version=$remote_version" | tee -a $GITHUB_OUTPUT | |
echo "remote_name=$remote_name" | tee -a $GITHUB_OUTPUT | |
outputs: | |
remote_version: ${{ steps.check_version.outputs.remote_version }} | |
remote_name: ${{ steps.check_version.outputs.remote_name }} | |
build: | |
name: Build | |
needs: check_update | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Set env | |
run: | | |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
if [ -n "${{ github.event.inputs.asl_version }}" ]; then | |
echo "version=${{ github.event.inputs.asl_version }}" | tee -a $GITHUB_ENV | |
else | |
echo "version=${{ needs.check_update.outputs.remote_version }}" | tee -a $GITHUB_ENV | |
fi | |
if [ -n "${{ github.event.inputs.release_name }}" ]; then | |
echo "release_name=${{ github.event.inputs.release_name }}" | tee -a $GITHUB_ENV | |
elif [ -n "${{ github.event.inputs.asl_version }}" ]; then | |
echo "release_name=${{ github.event.inputs.asl_version }}" | tee -a $GITHUB_ENV | |
else | |
echo "release_name=${{ needs.check_update.outputs.remote_name }}" | tee -a $GITHUB_ENV | |
fi | |
else | |
echo "version=${{ needs.check_update.outputs.remote_version }}" | tee -a $GITHUB_ENV | |
echo "release_name=${{ needs.check_update.outputs.remote_name }}" | tee -a $GITHUB_ENV | |
fi | |
echo "build_time=$(TZ=Asia/Shanghai date '+%Y%m%d%H%M')" | tee -a $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
- name: Build-Release | |
run: | | |
sudo apt update | |
sudo apt install -y zip | |
container_zip() { | |
local os=$1 | |
local version=$2 | |
sed -i "s/RURIMA_LXC_OS=\".*\"/RURIMA_LXC_OS=\"${os}\"/g" config.conf | |
sed -i "s/RURIMA_LXC_OS_VERSION=\".*\"/RURIMA_LXC_OS_VERSION=\"${version}\"/g" config.conf | |
zip -r "../asl-${os}-${version}.zip" . -x "*.git/*" -x ".github/*" | |
echo "asl-${os}-${version}.zip" | |
} | |
container_zip "archlinux" "current" | |
container_zip "alpine" "edge" | |
container_zip "centos" "9-Stream" | |
container_zip "debian" "bookworm" | |
container_zip "ubuntu" "jammy" | |
container_zip "ubuntu" "oracular" | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ env.version }} | |
name: ${{ env.release_name }} | |
body: | | |
You can only install one of these modules. | |
prerelease: false | |
files: | | |
${{ github.workspace }}/../asl-*.zip |