add windows release in github action #36
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release | |
on: | |
push: | |
tags: | |
- "test-release" | |
- "[0-9]+\\.[0-9]+" | |
jobs: | |
create-release: | |
name: create-release | |
runs-on: ubuntu-latest | |
steps: | |
- name: create release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build-archlinux: | |
name: build-archlinux | |
needs: ['create-release'] | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v4 | |
- name: build package | |
id: build_package | |
uses: PinkD/[email protected] | |
with: | |
target: "pkgbuild" | |
pkgname: "pack" | |
- name: upload package to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: pack/corplink-rs-${{ github.ref }}*.pkg.tar.zst | |
tag: ${{ github.ref }} | |
overwrite: true | |
file_glob: true | |
- name: create tarball | |
run: | | |
cp pack/pkg/corplink-rs/usr/bin/corplink-rs . | |
cp pack/pkg/corplink-rs/etc/corplink-rs/config.json . | |
tar -czf corplink-rs-${{ github.ref }}-linux-$(uname -m).tar.gz corplink-rs config.json | |
- name: upload tarball to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: pack/corplink-rs-${{ github.ref }}*.tar.gz | |
tag: ${{ github.ref }} | |
overwrite: true | |
file_glob: true | |
build-macos: | |
name: build-macos | |
needs: ['create-release'] | |
runs-on: macos-latest | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v4 | |
- name: setup go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.22.0' | |
- name: build libwg | |
run: cd libwg && ./build.sh | |
- name: build package | |
run: cargo build --release | |
- name: build tarball | |
run: | | |
cd target | |
cp release/corplink-rs . | |
cp ../config/config.json . | |
tar -czf corplink-rs-${{ github.ref }}-macos-$(uname -m).tar.gz corplink-rs config.json | |
- name: upload package to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: target/corplink-rs-*.tar.gz | |
tag: ${{ github.ref }} | |
overwrite: true | |
file_glob: true | |
build-windows: | |
name: build-windows | |
runs-on: windows-latest | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v4 | |
- name: setup go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.22.0' | |
- name: build libwg | |
run: cd libwg && ./build.ps1 | |
- name: rust install gnu toolchain | |
run: rustup toolchain install stable-gnu | |
- name: rust use gnu toolchain | |
run: rustup default stable-x86_64-pc-windows-gnu | |
- name: build package | |
run: cargo build --release | |
- name: build check result | |
run: | | |
Move-Item -Path "target/release/corplink-rs.exe" -Destination "." | |
Move-Item -Path "config/config.json" -Destination "." | |
Compress-Archive -Path corplink-rs.exe,config.json -Destination corplink-rs-${{ github.ref }}-windows.zip | |
- name: upload package to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: target/corplink-rs-${{ github.ref }}-windows.zip | |
tag: ${{ github.ref }} | |
overwrite: true | |
file_glob: true |