[command-enter to send] #1
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: [stable, beta] | |
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 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/grace grace | |
if: ${{ matrix.os != 'windows-latest' }} | |
- run: mv target/release/grace.exe grace | |
if: ${{ matrix.os == 'windows-latest' }} | |
- uses: actions/upload-artifact@v4 | |
if: ${{ matrix.rust == 'stable' }} | |
with: | |
name: ${{ matrix.os }} | |
path: grace | |
# - run: zip -9 grace.zip grace | |
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/grace grace | |
mv windows-latest/grace grace.exe | |
- run: gh release create ${{ env.BUILD_ID }} --target ${{ github.sha }} --generate-notes grace grace.exe | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |