fix: SC2086 #10
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 | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- "v*.*.*" | |
pull_request: | |
branches: | |
- "master" | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: get docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
m1cr/netcheck | |
ghcr.io/m1/netcheck | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- name: setup qemu | |
uses: docker/setup-qemu-action@v3 | |
- name: setup docker buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: login to dockerhub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: login to ghcr | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 | |
github: | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- target: x86_64-pc-windows-gnu | |
archive: zip | |
platform: windows_x86_64 | |
- target: x86_64-unknown-linux-musl | |
archive: tar.gz tar.bz2 tar.xz | |
platform: linux_x86_64 | |
- target: x86_64-apple-darwin | |
archive: zip | |
platform: macos_x86_64 | |
steps: | |
- uses: actions/checkout@@v4 | |
with: | |
fetch-depth: 0 | |
- uses: dtolnay/rust-toolchain@stable | |
- run: | | |
if [ "${GITHUB_REF##*/}" = main ]; then | |
echo "VERSION=latest" >> "$GITHUB_ENV" | |
else | |
echo "VERSION=${GITHUB_REF##*/}" >> "$GITHUB_ENV" | |
fi | |
echo "$VERSION" | |
- name: compile release | |
uses: rust-build/rust-build.action@v1.4.5 | |
id: release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
MINIFY: true | |
RUSTTARGET: ${{matrix.target}} | |
ARCHIVE_TYPES: ${{matrix.archive}} | |
UPLOAD_URL: "none" | |
ARCHIVE_NAME: netcheck_${{env.RELEASE_VERSION}}_${{matrix.platform}} | |
EXTRA_FILES: "README.md LICENSE" | |
- name: upload artifacts | |
uses: softprops/action-gh-release@v1 | |
id: release-upload | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: netcheck_${{env.RELEASE_VERSION}}_${{matrix.platform}} | |
tag_name: v${{env.VERSION}} | |
# body: ${{inputs.new_release_notes}} | |
generate_release_notes: true | |
prerelease: false | |
files: | | |
${{steps.release.outputs.BUILT_ARCHIVE}} | |
${{steps.release.outputs.BUILT_CHECKSUM}} |