try fix cd (#94) #31
Workflow file for this run
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: CD # Continuous Deployment | |
on: | |
push: | |
tags: | |
- '[v]?[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
publish: | |
name: Publishing for ${{ matrix.target }} | |
runs-on: ${{ matrix.os }} | |
env: | |
CARGO_TARGET_I586_UNKNOWN_LINUX_MUSL_RUSTFLAGS: -C target-feature=+sse2 | |
permissions: | |
contents: write | |
strategy: | |
matrix: | |
include: | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
binary-postfix: "" | |
binary-name: rainfrog | |
use-cross: false | |
features: default | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
binary-postfix: "" | |
use-cross: false | |
binary-name: rainfrog | |
features: default | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
binary-postfix: "" | |
use-cross: false | |
binary-name: rainfrog | |
features: default | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
binary-postfix: ".exe" | |
use-cross: false | |
binary-name: rainfrog | |
features: default | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-gnu | |
binary-postfix: "" | |
use-cross: true | |
binary-name: rainfrog | |
features: default | |
- os: ubuntu-latest | |
target: i686-unknown-linux-gnu | |
binary-postfix: "" | |
use-cross: true | |
binary-name: rainfrog | |
features: default | |
- os: ubuntu-latest | |
target: i686-unknown-linux-musl | |
binary-postfix: "" | |
use-cross: true | |
binary-name: rainfrog | |
features: default | |
- os: ubuntu-latest | |
target: aarch64-linux-android | |
binary-postfix: "" | |
use-cross: true | |
binary-name: rainfrog | |
features: termux --no-default-features | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
profile: minimal | |
override: true | |
- uses: Swatinem/rust-cache@v2 | |
- name: Cross build | |
if: ${{ matrix.use-cross == true }} | |
uses: houseabsolute/actions-rust-cross@v0 | |
with: | |
command: build | |
target: ${{ matrix.target }} | |
args: "--release --features ${{ matrix.features }}" | |
cross-version: 7b79041c9278769eca57fae10c74741f5aa5c14b | |
- name: Cargo build | |
if: ${{ matrix.use-cross != true }} | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
toolchain: stable | |
args: --release --target ${{ matrix.target }} --features ${{ matrix.features }} | |
- name: Packaging final binary | |
shell: bash | |
run: | | |
cd target/${{ matrix.target }}/release | |
########## create tar.gz ########## | |
BINARY_NAME=${{ matrix.binary-name }}${{ matrix.binary-postfix }} | |
RELEASE_NAME=${{ matrix.binary-name }}-${GITHUB_REF/refs\/tags\//}-${{ matrix.target }} | |
tar czvf $RELEASE_NAME.tar.gz $BINARY_NAME | |
########## create sha256 ########## | |
if [[ ${{ runner.os }} == 'Windows' ]]; then | |
certutil -hashfile $RELEASE_NAME.tar.gz sha256 | grep -E [A-Fa-f0-9]{64} > $RELEASE_NAME.sha256 | |
else | |
shasum -a 256 $RELEASE_NAME.tar.gz > $RELEASE_NAME.sha256 | |
fi | |
- name: Releasing assets | |
uses: softprops/action-gh-release@v1 | |
with: | |
generate_release_notes: true | |
files: | | |
target/${{ matrix.target }}/release/${{ matrix.binary-name }}-*.tar.gz | |
target/${{ matrix.target }}/release/${{ matrix.binary-name }}-*.sha256 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
docker-push: | |
name: Docker Build and Push | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker CLI | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
context: . | |
tags: achristmascarl/rainfrog:latest,achristmascarl/rainfrog:${{ github.ref_name }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max` | |
publish-cargo: | |
name: Publishing to Cargo | |
runs-on: ubuntu-latest | |
needs: publish | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo publish | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
release-commenter: | |
name: Commenting on Issues and PRs | |
runs-on: ubuntu-latest | |
needs: publish-cargo | |
permissions: | |
pull-requests: write | |
issues: write | |
steps: | |
- uses: apexskier/github-release-commenter@v1 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |