bug fixed #3
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: Release CI/CD | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v0.1.2' | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
strategy: | |
matrix: | |
file-extension: [""] | |
target: | |
- x86_64-unknown-linux-musl | |
- x86_64-unknown-linux-gnu | |
- armv7-unknown-linux-gnueabihf | |
- armv7-unknown-linux-musleabihf | |
platform: [ubuntu-20.04] | |
include: | |
- file-extension: .exe | |
target: x86_64-pc-windows-gnu | |
platform: ubuntu-20.04 | |
runs-on: ${{ matrix.platform }} | |
timeout-minutes: 240 # Increase the timeout to 4 hours | |
steps: | |
- name: Setup | Checkout | |
uses: actions/checkout@v2 | |
- name: Cache Cargo registry | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache Cargo build | |
uses: actions/cache@v2 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} | |
# - name: Setup | Version | |
# id: get_version | |
# run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | |
- name: Setup | Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
target: ${{ matrix.target }} | |
override: true | |
- name: Build | Release | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: true | |
command: build | |
args: --target ${{ matrix.target }} --release | |
- name: Build | Rename with Target | |
run: cp target/${{ matrix.target }}/release/ruststrom${{ matrix.file-extension }} rust-strom-${{ matrix.target }}-${{ steps.get_version.outputs.VERSION }}${{ matrix.file-extension }} | |
- name: Release | Upload Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: rust-strom-${{ matrix.target }}-${{ steps.get_version.outputs.VERSION }}${{ matrix.file-extension }} | |
path: rust-strom-${{ matrix.target }}-${{ steps.get_version.outputs.VERSION }}${{ matrix.file-extension }} | |
build-docker: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Setup | Checkout | |
uses: actions/checkout@v2 | |
- name: Setup | Docker meta | |
id: docker_meta | |
uses: crazy-max/ghaction-docker-meta@v1 | |
with: | |
images: rust-strom/rust-strom-lb | |
tag-semver: | | |
{{version}} | |
{{major}}.{{minor}} | |
- name: Setup | QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Setup | Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Setup | Docker Login | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build | Build and Push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64 | |
push: true | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} | |
release: | |
needs: [build, build-docker] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Release | Download Artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
path: artifacts | |
- name: Release | GitHub | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }} | |
with: | |
name: ARLB ${{ github.ref }} | |
body: | | |
TODO | |
draft: true | |
prerelease: false | |
files: | | |
artifacts/**/* | |
- name: Release | Purge Artifacts | |
uses: kolpav/purge-artifacts-action@v1 | |
with: | |
token: ${{ secrets.PERSONAL_TOKEN }} | |
expire-in: "0d" |