use rust 1.69-alpine #6
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: Docker | |
on: | |
push: | |
tags: | |
- "v*" | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
REGISTRY: ghcr.io | |
IMAGE_NAME: telkomindonesia/rathole | |
jobs: | |
release: | |
name: Cross build for x86_64-unknown-linux-gnu | |
runs-on: ubuntu-latest | |
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 x86_64-unknown-linux-gnu --verbose | |
- name: Build release | |
run: cross build --release --target x86_64-unknown-linux-gnu | |
- name: Run UPX | |
# Upx may not support some platforms. Ignore the errors | |
continue-on-error: true | |
uses: crazy-max/ghaction-upx@v1 | |
with: | |
version: v4.0.2 | |
files: target/x86_64-unknown-linux-gnu/release/rathole | |
args: -q --best --lzma | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: rathole-x86_64-unknown-linux-gnu | |
path: target/x86_64-unknown-linux-gnu/release/rathole | |
- name: Zip Release | |
uses: TheDoctor0/zip-release@0.6.1 | |
with: | |
type: zip | |
filename: rathole-x86_64-unknown-linux-gnu.zip | |
directory: target/x86_64-unknown-linux-gnu/release/ | |
path: rathole | |
- name: Publish | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: target/x86_64-unknown-linux-gnu/release/rathole-x86_64-unknown-linux-gnuss.zip | |
generate_release_notes: true | |
draft: true | |
docker: | |
name: Publish to Docker Hub | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
needs: release | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }} |