Skip to content

Merge pull request #6 from Asterisk4Magisk/dependabot/github_actions/… #174

Merge pull request #6 from Asterisk4Magisk/dependabot/github_actions/…

Merge pull request #6 from Asterisk4Magisk/dependabot/github_actions/… #174

Workflow file for this run

name: Build
on:
workflow_dispatch:
push:
branches:
- master
paths:
- "**/*.go"
- "go.mod"
- ".github/workflows/*.yml"
pull_request:
types: [opened, synchronize, reopened]
paths:
- "**/*.go"
- "go.mod"
- ".github/workflows/*.yml"
jobs:
build:
permissions:
contents: write
strategy:
matrix:
include:
- goos: android
goarch: arm64
- goos: android
goarch: amd64
fail-fast: false
runs-on: ubuntu-latest
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GOARM: ${{ matrix.goarm }}
CGO_ENABLED: 0
steps:
- name: Checkout codebase
uses: actions/checkout@v4
- name: Show workflow information
run: |
export _NAME=$(jq ".[\"$GOOS-$GOARCH$GOARM$GOMIPS\"].friendlyName" -r < .github/build/friendly-filenames.json)
echo "GOOS: $GOOS, GOARCH: $GOARCH, GOARM: $GOARM, GOMIPS: $GOMIPS, RELEASE_NAME: $_NAME"
echo "ASSET_NAME=$_NAME" >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
check-latest: true
- name: Get project dependencies
run: go get ./main
- name: Build XrayHelper
run: |
mkdir -p build_assets
go build -v -o build_assets/xrayhelper -trimpath -ldflags "-s -w -buildid=" ./main
- name: Copy Files
run: |
cp ${GITHUB_WORKSPACE}/README.md ./build_assets/README.md
cp ${GITHUB_WORKSPACE}/README_zh_CN.md ./build_assets/README_zh_CN.md
cp ${GITHUB_WORKSPACE}/LICENSE ./build_assets/LICENSE
cp ${GITHUB_WORKSPACE}/config.yml ./build_assets/config.yml
- name: Create ZIP archive
shell: bash
run: |
pushd build_assets || exit 1
touch -mt $(date +%Y01010000) *
zip -9vr ../XrayHelper-${{ env.ASSET_NAME }}.zip .
popd || exit 1
FILE=./XrayHelper-${{ env.ASSET_NAME }}.zip
DGST=$FILE.dgst
for METHOD in {"md5","sha1","sha256","sha512"}
do
openssl dgst -$METHOD $FILE | sed 's/([^)]*)//g' >>$DGST
done
- name: Change the name
run: |
mv build_assets XrayHelper-${{ env.ASSET_NAME }}
- name: Upload files to Artifacts
uses: actions/upload-artifact@v3
with:
name: XrayHelper-${{ env.ASSET_NAME }}
path: |
./XrayHelper-${{ env.ASSET_NAME }}/*