Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the problem that test actions cannot upload windows binary files, add the function of custom form to set tag version. #94

Merged
merged 3 commits into from
Mar 21, 2023
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
44 changes: 26 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
name: Test App With Cache

on:
workflow_dispatch: {}
workflow_dispatch:
inputs:
version:
description: "tag version"
required: true
default: "v0.0.1"

jobs:
publish:
Expand Down Expand Up @@ -44,10 +49,6 @@ jobs:
with:
fetch-depth: 1

- name: Set the version
id: version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
Expand Down Expand Up @@ -75,25 +76,32 @@ jobs:
command: build
args: --target ${{ matrix.target }} --release --locked

- name: Upload files (only for Mac/Linux)
- name: Rename files (only for Mac/Linux)
if: matrix.target != 'x86_64-pc-windows-msvc'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
UPLOADTOOL_ISPRERELEASE: true
VERSION: ${{ inputs.version }}
run: |
curl -L https://github.com/probonopd/uploadtool/raw/master/upload.sh --output upload.sh
mv target/${{ matrix.target }}/release/et et-${{ matrix.target }}
bash upload.sh et-${{ matrix.target }}
mkdir output/
mv target/${{ matrix.target }}/release/et et
tar -cavf output/et-${VERSION}-${{ matrix.target }}.tar.gz et CHANGELOG.md README.md LICENSE

- name: Upload files (only for Windows)
- name: Rename files (only for Windows)
if: matrix.target == 'x86_64-pc-windows-msvc'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
UPLOADTOOL_ISPRERELEASE: true
VERSION: ${{ inputs.version }}
run: |
curl -L https://github.com/probonopd/uploadtool/raw/master/upload.sh --output upload.sh
mv target/${{ matrix.target }}/release/et.exe et-${{ matrix.target }}.exe
bash upload.sh et-${{ matrix.target }}.exe
mkdir output/
mv target/${{ matrix.target }}/release/et.exe output/et-$env:VERSION-${{ matrix.target }}.exe

- name: Upload files
# arg info: https://github.com/ncipollo/release-action#release-action
uses: ncipollo/release-action@v1
with:
allowUpdates: true
prerelease: true
artifacts: "output/*"
tag: ${{ inputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}


- name: rust cache store
Expand All @@ -105,4 +113,4 @@ jobs:
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}