Skip to content

Merge pull request #4 from mirumirumi/dev #26

Merge pull request #4 from mirumirumi/dev

Merge pull request #4 from mirumirumi/dev #26

Workflow file for this run

name: release
on:
push:
branches:
- main
jobs:
mac:
runs-on: macos-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Build for Mac
run: |
cargo install cross
cross build --target x86_64-apple-darwin --release
mv ./target/x86_64-apple-darwin/release/ro-soku ./target/x86_64-apple-darwin/release/ro-soku_x86_64_mac
sha256_mac_x86_64=$(shasum -a 256 ./target/x86_64-apple-darwin/release/ro-soku_x86_64_mac)
sha256_mac_x86_64=${sha256_mac_x86_64:0:64}
echo "sha256_mac_x86_64=${sha256_mac_x86_64}" >> $GITHUB_ENV
- name: Get the application version
run: |
version=$(grep -E '^version' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
echo "version=${version}" >> $GITHUB_ENV
- name: Requeste to workflow of homebrew Ruby repo
run: |
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.PAT }}" \
-d '{"ref": "main", "inputs": {"version": "${{ env.version }}", "sha256_mac_x86_64": "${{ env.sha256_mac_x86_64 }}"}}' \
https://api.github.com/repos/mirumirumi/homebrew-ro-soku/actions/workflows/release.yaml/dispatches
- name: Upload Mac binary
uses: actions/upload-artifact@v3
with:
name: ro-soku_x86_64_mac
path: |
./target/x86_64-apple-darwin/release/ro-soku_x86_64_mac
linux-windows:
needs: mac
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Exec unit tests
run: |
sh scripts/unit-test.sh
- name: Build for Linux
run: |
cargo build --release
mv ./target/release/ro-soku ./target/release/ro-soku_x86_64_linux
- name: Build for Windows
run: |
cargo install cross
cross build --target x86_64-pc-windows-gnu --release
- name: Exec integration tests
run: |
bash scripts/integration-test.sh
- name: Get the application version
run: |
version=$(grep -E '^version' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
echo "version=${version}" >> $GITHUB_ENV
- name: Download Mac binary
uses: actions/download-artifact@v3
with:
name: ro-soku_x86_64_mac
path: ./target
- name: Create a tag
uses: rickstaa/action-create-tag@v1
with:
tag: "${{ env.version }}"
force_push_tag: true
- name: Create a release
uses: ncipollo/release-action@v1
with:
artifacts: ./target/release/ro-soku_x86_64_linux, ./target/x86_64-pc-windows-gnu/release/ro-soku.exe, ./target/ro-soku_x86_64_mac
tag: "${{ env.version }}"
token: ${{ secrets.PAT }}
skipIfReleaseExists: true