ci #166
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: ci | |
on: | |
push: | |
pull_request: | |
schedule: [cron: "40 1 * * *"] | |
permissions: | |
contents: read | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
assign: | |
name: assign build_id | |
runs-on: ubuntu-latest | |
steps: | |
- run: wget https://github.com/trevyn/animal-time/releases/latest/download/animal-time | |
- run: chmod +x animal-time | |
- run: ./animal-time > build_id | |
- run: cat build_id | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: build_id | |
path: build_id | |
build: | |
needs: [assign] | |
name: build rust ${{ matrix.rust }} ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
rust: [nightly] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
- run: cat build_id/build_id | |
- run: echo "BUILD_ID=$(cat build_id/build_id)" >> $GITHUB_ENV | |
- run: rustup default ${{ matrix.rust }} && rustup update ${{ matrix.rust }} | |
- run: sudo apt-get update | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
- run: sudo apt-get install libgtk-3-dev libasound2-dev | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
- run: cargo build --release | |
- run: ls | |
- run: ls | |
working-directory: target | |
- run: ls | |
working-directory: target/release | |
- run: mv target/release/brace brace | |
if: ${{ matrix.os != 'windows-latest' }} | |
- run: mv target/release/brace.exe brace | |
if: ${{ matrix.os == 'windows-latest' }} | |
- uses: actions/upload-artifact@v4 | |
if: ${{ matrix.rust == 'nightly' }} | |
with: | |
name: ${{ matrix.os }} | |
path: brace | |
# - run: zip -9 brace.zip brace | |
release: | |
permissions: | |
contents: write | |
needs: [assign, build] | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
- run: cat build_id/build_id | |
- run: echo "BUILD_ID=$(cat build_id/build_id)" >> $GITHUB_ENV | |
- run: | | |
mv macos-latest/brace brace | |
mv windows-latest/brace brace.exe | |
- run: gh release create ${{ env.BUILD_ID }} --target ${{ github.sha }} --generate-notes brace brace.exe | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |