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

Add release ci #2

Merged
merged 55 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
6d9aa45
Create release.yml
Bluemangoo Apr 28, 2024
c61c9a5
Update release.yml
Bluemangoo Apr 28, 2024
e86e0f1
Update release.yml
Bluemangoo Apr 28, 2024
a56b53d
Update release.yml
Bluemangoo Apr 28, 2024
f426a5d
Update release.yml
Bluemangoo Apr 28, 2024
1eeaf8f
Update release.yml
Bluemangoo Apr 28, 2024
af6d6a4
Update release.yml
Bluemangoo Apr 29, 2024
6af85a0
Update release.yml
Bluemangoo Apr 29, 2024
6b0cdc1
Update release.yml
Bluemangoo Apr 29, 2024
03de9b5
Update release.yml
Bluemangoo Apr 29, 2024
ac2ecff
Update release.yml
Bluemangoo Apr 29, 2024
fc76ee6
Update release.yml
Bluemangoo Apr 29, 2024
c7ae988
Update release.yml
Bluemangoo Apr 29, 2024
f03830f
Update release.yml
Bluemangoo Apr 30, 2024
e37bc56
[Release] Update release.yml
Bluemangoo Apr 30, 2024
fe629ea
[Release] Update release.yml
Bluemangoo Apr 30, 2024
1ca5fd3
[Release] Update release.yml
Bluemangoo Apr 30, 2024
5ca1a27
[Release] Update release.yml
Bluemangoo Apr 30, 2024
094e185
[Release] Update Cargo.toml
Bluemangoo Apr 30, 2024
b3dffca
[Release] Update release.yml
Bluemangoo Apr 30, 2024
76a663e
Update release.yml
Bluemangoo Apr 30, 2024
d924541
[Release] Update release.yml
Bluemangoo Apr 30, 2024
7a9664f
[Release]Update release.yml
Bluemangoo Apr 30, 2024
fb5bc8e
[Release]Update release.yml
Bluemangoo Apr 30, 2024
b8ff7c6
[Release] Update release.yml
Bluemangoo Apr 30, 2024
d10aca2
[Release]Update release.yml
Bluemangoo Apr 30, 2024
a4e253f
[Release]Update release.yml
Bluemangoo Apr 30, 2024
7a00b3d
[Release]Update release.yml
Bluemangoo Apr 30, 2024
60a4804
[Release]Update release.yml
Bluemangoo Apr 30, 2024
b11dcac
[Release]Update release.yml
Bluemangoo Apr 30, 2024
6d154d9
[Release]Update release.yml
Bluemangoo Apr 30, 2024
25fd8a4
Update release.yml
Bluemangoo Apr 30, 2024
b519676
[Release]Update release.yml
Bluemangoo Apr 30, 2024
446a219
[Release]Update release.yml
Bluemangoo Apr 30, 2024
fbd881f
[ReleaseUpdate release.yml
Bluemangoo Apr 30, 2024
133b2ee
[Release]Update release.yml
Bluemangoo Apr 30, 2024
2f13659
Create getReleaseInfo.sh
Bluemangoo Apr 30, 2024
28315f4
[Release]Update release.yml
Bluemangoo Apr 30, 2024
2d71fc8
[Release]Update getReleaseInfo.sh
Bluemangoo Apr 30, 2024
7b986bf
Create check.sh
Bluemangoo Apr 30, 2024
3bb32ee
[Release]Update release.yml
Bluemangoo Apr 30, 2024
4534b56
[Release]Update check.sh
Bluemangoo Apr 30, 2024
b746cd5
[Release]Update release.yml
Bluemangoo Apr 30, 2024
89cb302
[Release]Update check.sh
Bluemangoo Apr 30, 2024
0ccb0bb
[Release]Update getReleaseInfo.sh
Bluemangoo Apr 30, 2024
4bc2a0b
Update getReleaseInfo.sh
Bluemangoo Apr 30, 2024
cb26981
Update getReleaseInfo.sh
Bluemangoo Apr 30, 2024
b0fd081
[Release]Update getReleaseInfo.sh
Bluemangoo Apr 30, 2024
eda7cb5
Update getReleaseInfo.sh
Bluemangoo Apr 30, 2024
645ac46
Update release.yml
Bluemangoo Apr 30, 2024
7a8e42d
Update build.yml
Bluemangoo Apr 30, 2024
f0caf98
Update release.yml
Bluemangoo Apr 30, 2024
69b429a
[Release] rm sh
Bluemangoo Apr 30, 2024
ca158e1
Update release.yml
Bluemangoo Apr 30, 2024
e449b4b
Update Cargo.toml
Bluemangoo Apr 30, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Rust
name: Build

on:
push:
Expand All @@ -9,7 +9,7 @@ env:

jobs:
build:

if: "!contains(github.event.commits[0].message, '[Release]')"
runs-on: ubuntu-latest

steps:
Expand Down
152 changes: 152 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
name: Release

on:
push:
branches: []
workflow_dispatch:

permissions:
contents: write

env:
CARGO_TERM_COLOR: always

jobs:
check:
runs-on: ubuntu-latest
if: "contains(github.event.commits[0].message, '[Release]')"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check git tag
run: |
version=$(grep version Cargo.toml -m 1 | cut -d'=' -f2 | tr -d "\r" | tr -d ' ' | tr -d '"' | tr -d "'")
git rev-parse $version || exit 0
exit 1
build:
runs-on: ${{ matrix.host_os }}
if: "contains(github.event.commits[0].message, '[Release]')"
needs: check
strategy:
matrix:
target:
- aarch64-apple-darwin
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- arm-unknown-linux-gnueabi
- armv7-unknown-linux-musleabihf
- i686-unknown-linux-gnu
- i686-unknown-linux-musl
- x86_64-apple-darwin
- x86_64-unknown-linux-musl
- x86_64-unknown-linux-gnu

include:
- target: aarch64-apple-darwin
host_os: macos-latest

- target: aarch64-unknown-linux-gnu
host_os: ubuntu-latest
cross: true

- target: aarch64-unknown-linux-musl
host_os: ubuntu-latest
cross: true

- target: arm-unknown-linux-gnueabi
host_os: ubuntu-latest
cross: true

- target: armv7-unknown-linux-musleabihf
host_os: ubuntu-latest
cross: true

- target: i686-unknown-linux-gnu
host_os: ubuntu-latest
packages: "gcc-multilib libc6-dev-i386"

- target: i686-unknown-linux-musl
host_os: ubuntu-latest
cross: true

- target: x86_64-apple-darwin
host_os: macos-latest

- target: x86_64-unknown-linux-musl
host_os: ubuntu-latest
packages: "musl-tools"

- target: x86_64-unknown-linux-gnu
host_os: ubuntu-latest
packages: ""
steps:
- uses: actions/checkout@v4
- name: Install deps
if: ${{ contains(matrix.host_os, 'ubuntu') && !matrix.cross }}
run: |
sudo apt-get update -y
sudo apt-get -yq --no-install-suggests --no-install-recommends install ${{ matrix.packages }}
- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
prefix-key: v0-rust-build-${{ matrix.target }}
cache-all-crates: true
- name: Install cross
if: ${{ matrix.cross }}
run: cargo install cross
- name: Install targets
if: ${{ !matrix.cross }}
run: rustup target add ${{ matrix.target }}
- name: Build
if: ${{ !matrix.cross }}
run: cargo build --release --target ${{ matrix.target }}
- name: Cross build
if: ${{ matrix.cross }}
run: cross build --release --target ${{ matrix.target }}
- name: Pack
run: |
mkdir target/pingpong || rm -rf target/pingpong/*
mv target/${{ matrix.target }}/release/pingpong target/pingpong/pingpong
cp -r config target/pingpong/config
cd target/pingpong
zip -r pingpong-${{ matrix.target }}.zip *
- name: Upload
uses: actions/upload-artifact@v4
with:
name: pingpong-${{ matrix.target }}
path: target/pingpong/pingpong-${{ matrix.target }}.zip
release:
needs: build
runs-on: ubuntu-latest
if: "contains(github.event.commits[0].message, '[Release]')"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Generate release info and tag
run: |
version=$(grep version Cargo.toml -m 1 | cut -d'=' -f2 | tr -d "\r" | tr -d ' ' | tr -d '"' | tr -d "'")
echo "version=$version">>$GITHUB_ENV
release_info=release.md
echo "release_info=$release_info">>$GITHUB_ENV
echo "## Changes" > $release_info
number=$(git log --oneline $(git rev-parse `git describe --tags --abbrev=0`)..HEAD | wc -l)
echo "$(git log --pretty='- [%h] %s' -$number)" >> $release_info
- run: |
echo ${{env.version}}
echo ${{env.release_info}}
- name: Create Release
if: "!contains(github.event.commits[0].message, '[release-skip]')"
uses: ncipollo/[email protected]
with:
artifacts: artifacts/*
bodyFile: ${{ env.release_info }}
tag: ${{ env.version }}
name: ${{ env.version }}
makeLatest: true