Skip to content

Commit

Permalink
chore: add release CI action
Browse files Browse the repository at this point in the history
  • Loading branch information
infiniteregrets committed Nov 4, 2024
1 parent d634779 commit 1d21c7a
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: release
on:
push:
tags: ["[0-9]+.[0-9]+.[0-9]+*"]
workflow_dispatch:
jobs:
build_binaries:
name: ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: windows-latest
target: aarch64-pc-windows-msvc
steps:
- name: checkout
uses: actions/checkout@v4
- name: version
id: version
uses: SebRollen/[email protected]
with:
file: Cargo.toml
field: package.version
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ""
- uses: taiki-e/install-action@v2
with:
tool: cross
- name: Build
run: cross build --release --target ${{ matrix.target }}
- name: Prepare artifacts
shell: bash
run: |
cd target/${{ matrix.target }}/release
if [ "${{ matrix.os }}" = "windows-latest" ];
then\n 7z a ../../../$s2-cli-${{ matrix.target }}.zip $s2-cli.exe
else
tar -czf ../../../$s2-cli-${{ matrix.target }}.tar.gz $s2-cli
fi
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: |
*.tar.gz
*.zip
if-no-files-found: error

create_release:
needs: build_binaries
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: download artifacts
uses: actions/download-artifact@v4
- name: create Release
uses: softprops/action-gh-release@v2
with:
files: |
**/*.tar.gz
**/*.zip
draft: true
generate_release_notes: true
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.0.1

- All s2 operations.

0 comments on commit 1d21c7a

Please sign in to comment.