Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 39 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
Expand All @@ -20,19 +20,46 @@ jobs:
override: true
- name: Build release binary
run: cargo build --verbose --release
- name: Package artifacts
- name: Package binary
shell: pwsh
run: |
mkdir -p dist
cp target/release/EasyProxy dist/
cd dist
tar czf EasyProxy-${{ github.ref_name }}-linux-amd64.tar.gz EasyProxy
- name: Upload artifact
uses: actions/upload-artifact@v3
New-Item -ItemType Directory -Force dist
Copy-Item target/release/EasyProxy.exe dist/
Compress-Archive -Path dist/EasyProxy.exe -DestinationPath release.zip
- name: Upload Release
uses: actions/upload-artifact@v4
with:
name: EasyProxy-${{ github.ref_name }}
path: dist/EasyProxy-${{ github.ref_name }}-linux-amd64.tar.gz
- name: Upload release asset
name: EasyProxy
path: release.zip
retention-days: 30
- name: Get existing Release upload URL
id: get_release
uses: actions/github-script@v6
with:
script: |
const tag = context.ref.startsWith('refs/tags/') ? context.ref.substring('refs/tags/'.length) : context.ref;
core.info(`Using tag: ${tag}`);
const release = await github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: tag
});
const uploadUrl = release.data.upload_url; // 不要去掉 {?name,label}
core.info(`Found release with upload_url: ${uploadUrl}`);
return uploadUrl;
- name: Debug GITHUB_TOKEN
shell: pwsh
run: |
if ($env:GITHUB_TOKEN) {
Write-Host 'GITHUB_TOKEN is defined.'
} else {
Write-Host 'GITHUB_TOKEN is NOT defined.'
}
- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: dist/EasyProxy-${{ github.ref_name }}-linux-amd64.tar.gz
files: |
release.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading