add temp-release #3
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: Temp Release | |
on: | |
push: | |
tags: | |
- "v*" | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
release: | |
name: Cross build for ${{ matrix.target }} | |
runs-on: ${{ matrix.os }}s | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
exe: rathole | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
exe: rathole | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-musl | |
exe: rathole | |
- os: ubuntu-latest | |
target: arm-unknown-linux-musleabi | |
exe: rathole | |
- os: ubuntu-latest | |
target: arm-unknown-linux-musleabihf | |
exe: rathole | |
- os: ubuntu-latest | |
target: armv7-unknown-linux-musleabihf | |
exe: rathole | |
- os: ubuntu-latest | |
target: mips-unknown-linux-gnu | |
exe: rathole | |
- os: ubuntu-latest | |
target: mips-unknown-linux-musl | |
exe: rathole | |
- os: ubuntu-latest | |
target: mipsel-unknown-linux-gnu | |
exe: rathole | |
- os: ubuntu-latest | |
target: mipsel-unknown-linux-musl | |
exe: rathole | |
- os: ubuntu-latest | |
target: mips64-unknown-linux-gnuabi64 | |
exe: rathole | |
- os: ubuntu-latest | |
target: mips64el-unknown-linux-gnuabi64 | |
exe: rathole | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
exe: rathole | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
exe: rathole.exe | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
- name: Install cross | |
run: cargo install --version 0.1.16 cross | |
- name: Run tests | |
run: cross test --release --target ${{ matrix.target }} --verbose | |
- name: Build release | |
run: cross build --release --target ${{ matrix.target }} | |
- name: Run UPX | |
# Upx may not support some platforms. Ignore the errors | |
continue-on-error: true | |
# Disable upx for mips. See https://github.com/upx/upx/issues/387 | |
if: matrix.os == 'ubuntu-latest' && !contains(matrix.target, 'mips') | |
uses: crazy-max/ghaction-upx@v1 | |
with: | |
version: v4.0.2 | |
files: target/${{ matrix.target }}/release/${{ matrix.exe }} | |
args: -q --best --lzma | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: rathole-${{ matrix.target }} | |
path: target/${{ matrix.target }}/release/${{ matrix.exe }} | |
- name: Zip Release | |
uses: TheDoctor0/zip-release@0.6.1 | |
with: | |
type: zip | |
filename: rathole-${{ matrix.target }}.zip | |
directory: target/${{ matrix.target }}/release/ | |
path: ${{ matrix.exe }} | |
- name: Publish | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: target/${{ matrix.target }}/release/rathole-${{ matrix.target }}.zip | |
generate_release_notes: true | |
draft: true | |
docker: | |
runs-on: ubuntu-latest | |
needs: release | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- id: docker_meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} | |
tags: | | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
- id: docker_build | |
name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
platforms: linux/amd64 | |
push: true | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} |