update github action
Former-commit-id: 909a8999745388e1efc6a0087d8f1d2cb339b54f [formerly 9bcc5c7d966659b56d80cab610d687b408b531a3] [formerly 708ea0512cfa490eaa9fafa1f92ea16bdc21cf05 [formerly e05dcfca80571c20cee55718528997e65c8c6110]] Former-commit-id: 21cec496e03f2289531cc5cb20f3b72b8e5b982e [formerly 24e36e46cb412e2743754908cf01ac6c9f88a5db] Former-commit-id: cb9af7fe2caffdc2d6c83a14b7c34eb5ef63e2aa Former-commit-id: 0542a1b9531595d1084c2f70c830d536f84cb0b0 Former-commit-id: 63bb8b12a848a54da8939ab9fcc550de116d77ce Former-commit-id: d139330add70fde1ad06f12c0076b469f20f12e8 [formerly d68fa5332df916927236e4ebd71db495dce065df] Former-commit-id: 6add272957a89d43f310f44c70b17ca2cecd927a
This commit is contained in:
parent
482df216ca
commit
0973359ea3
3 changed files with 76 additions and 29 deletions
43
.github/workflows/release.yaml
vendored
43
.github/workflows/release.yaml
vendored
|
@ -110,37 +110,22 @@ jobs:
|
||||||
- name: Checkout Git repo
|
- name: Checkout Git repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
# Download all artifacts in zip format
|
# Download all artifacts
|
||||||
# https://github.com/actions/download-artifact/issues/143
|
- uses: actions/download-artifact@v3
|
||||||
- name: Download artifacts
|
|
||||||
uses: actions/github-script@v6
|
|
||||||
with:
|
with:
|
||||||
script: |
|
path: artifacts
|
||||||
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
run_id: context.payload.workflow_run.id,
|
|
||||||
});
|
|
||||||
for (const artifact of allArtifacts.data.artifacts)
|
|
||||||
{
|
|
||||||
let download = await github.rest.actions.downloadArtifact({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
artifact_id: artifact.id,
|
|
||||||
archive_format: 'zip',
|
|
||||||
});
|
|
||||||
|
|
||||||
let fs = require('fs');
|
|
||||||
fs.mkdirSync('artifacts');
|
|
||||||
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/artifacts/${artifact.name}.zip`, Buffer.from(download.data));
|
|
||||||
}
|
|
||||||
|
|
||||||
- name: list artifacts
|
- name: list artifacts
|
||||||
run: find artifacts/
|
run: find artifacts/
|
||||||
|
|
||||||
- uses: "marvinpinto/action-automatic-releases@latest"
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v4
|
||||||
|
|
||||||
|
- name: Run GoReleaser
|
||||||
|
uses: goreleaser/goreleaser-action@v5
|
||||||
with:
|
with:
|
||||||
repo_token: "${{ secrets.RELEASE_TOKEN }}"
|
distribution: goreleaser
|
||||||
prerelease: true
|
version: latest
|
||||||
files: |
|
args: release --clean --skip=validate
|
||||||
artifacts/*
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||||
|
|
35
.goreleaser.yaml
Normal file
35
.goreleaser.yaml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
builds:
|
||||||
|
- goos:
|
||||||
|
- linux
|
||||||
|
- darwin
|
||||||
|
- windows
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
- arm
|
||||||
|
goarm:
|
||||||
|
- "7"
|
||||||
|
binary: wstunnel
|
||||||
|
ignore:
|
||||||
|
- goos: windows
|
||||||
|
goarch: arm64
|
||||||
|
- goos: windows
|
||||||
|
goarch: arm
|
||||||
|
- goos: darwin
|
||||||
|
goarch: arm64
|
||||||
|
- goos: darwin
|
||||||
|
goarch: arm
|
||||||
|
main: goreleaser.go
|
||||||
|
hooks:
|
||||||
|
pre:
|
||||||
|
- /bin/sh -c "if [ ! -e ./goreleaser.go ]; then echo -e 'package main\\\nfunc main() { }' > ./goreleaser.go ; fi"
|
||||||
|
post:
|
||||||
|
- ./.goreleaser_hook.sh {{ .Arch }} {{ .Os }} {{ .ProjectName }}
|
||||||
|
checksum:
|
||||||
|
name_template: "checksums.txt"
|
||||||
|
changelog:
|
||||||
|
sort: asc
|
||||||
|
filters:
|
||||||
|
exclude:
|
||||||
|
- "^docs:"
|
||||||
|
- "^test:"
|
27
.goreleaser_hook.sh
Executable file
27
.goreleaser_hook.sh
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
go_arch=$1
|
||||||
|
go_os=$2
|
||||||
|
project_name=$3
|
||||||
|
|
||||||
|
# Make Go -> Rust arch/os mapping
|
||||||
|
case $go_arch in
|
||||||
|
amd64) rust_arch='x86_64' ;;
|
||||||
|
arm64) rust_arch='aarch64' ;;
|
||||||
|
arm) rust_arch='armv7' ;;
|
||||||
|
*) echo "unknown arch: $go_arch" && exit 1 ;;
|
||||||
|
esac
|
||||||
|
case $go_os in
|
||||||
|
linux) rust_os='linux' ;;
|
||||||
|
darwin) rust_os='apple-darwin' ;;
|
||||||
|
windows) rust_os='windows' ;;
|
||||||
|
*) echo "unknown os: $go_os" && exit 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Find artifacts and uncompress in the coresponding directory
|
||||||
|
DIST_DIR=$(find dist -type d -name "*${go_os}_${go_arch}*")
|
||||||
|
echo "DIST_DIR: $DIST_DIR"
|
||||||
|
rm -rf ${DIST_DIR}/*
|
||||||
|
|
||||||
|
find artifacts -type f -wholename "*${rust_arch}*${rust_os}*" -exec cp {} ${DIST_DIR} \;
|
||||||
|
|
Loading…
Reference in a new issue