diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..5f34ed6 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,46 @@ +name: Rust CI and release + +on: + push: + branches: + - '**' + tags: + - '*' + pull_request: + branches: + - '**' + +jobs: + build: + runs-on: ubuntu-22.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + - name: Add target for cross-compilation + run: rustup target add thumbv6m-none-eabi + + - name: Install flip-link + run: cargo install flip-link + + - name: Build the project + run: cargo build --release --target=thumbv6m-none-eabi + + - name: Generate SHA256 checksum + run: sha256sum ./target/thumbv6m-none-eabi/release/tc2-firmware | cut -d ' ' -f 1 > ./target/thumbv6m-none-eabi/release/tc2-firmware.sha256 + + - name: Upload release assets + if: startsWith(github.ref, 'refs/tags/') + uses: ncipollo/release-action@v1 + with: + artifacts: | + ./target/thumbv6m-none-eabi/release/tc2-firmware + ./target/thumbv6m-none-eabi/release/tc2-firmware.sha256 + allowUpdates: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6f0d356..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -language: rust -rust: - - stable - -cache: cargo - -os: linux -dist: focal - -before_script: - - rustup target add thumbv6m-none-eabi - - cargo install flip-link - -script: - - cargo build --release - - sha256sum ./target/thumbv6m-none-eabi/release/tc2-firmware | cut -d ' ' -f 1 > ./target/thumbv6m-none-eabi/release/tc2-firmware.sha256 - -deploy: - provider: releases - api_key: $GITHUB_TOKEN - file: - - "./target/thumbv6m-none-eabi/release/tc2-firmware" - - "./target/thumbv6m-none-eabi/release/tc2-firmware.sha256" - skip_cleanup: true - on: - tags: true