Skip to content

fix

fix #17

Workflow file for this run

name: Publish
on:
push:
tags:
- "*"
branches:
- master
pull_request:
jobs:
create-windows-assets:
name: release ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
build:
- linux-x86_64
- macos-x86_64
- windows-x86_64-msvc
include:
- build: linux-x86_64
os: ubuntu-latest
# rust: nightly
target: x86_64-unknown-linux-gnu
- build: macos-x86_64
os: macos-latest
# rust: nightly
target: x86_64-apple-darwin
# - build: windows-x86_64-gnu
# os: windows-latest
# rust: nightly-x86_64-gnu
# target: x86_64-pc-windows-gnu
- build: windows-x86_64-msvc
os: windows-latest
# rust: nightly-x86_64-msvc
target: x86_64-pc-windows-msvc
# - x86_64-pc-windows-msvc
# - i686-pc-windows-msvc
# - x86_64-unknown-linux-musl
# - x86_64-apple-darwin
# include:
# - os: ubuntu-latest
# target: x86_64-unknown-linux-musl
# archive: zip
# - os: windows-latest
# target: i686-pc-windows-msvc
# archive: zip
# - os: windows-latest
# target: x86_64-pc-windows-msvc
# archive: zip
# - os: macos-latest
# target: x86_64-apple-darwin
# archive: zip
steps:
- name: disable git eol translation
run: git config --global core.autocrlf false
- uses: actions/checkout@master
# Run build
- name: install rustup
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh
sh rustup-init.sh -y --default-toolchain none
rustup target add ${{ matrix.target }}
# - name: Install Rustup using win.rustup.rs
# run: |
# # Disable the download progress bar which can cause perf issues
# $ProgressPreference = "SilentlyContinue"
# Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe
# .\rustup-init.exe -y --default-host=x86_64-pc-windows-msvc --default-toolchain=none
# del rustup-init.exe
# rustup target add ${{ matrix.target }}
# shell: powershell
- name: Build release binaries
run: cargo build --release
- name: Build archive
shell: bash
run: |
staging="rust-experiments-${{ matrix.build }}_${{ github.event.release.tag_name }}"
mkdir -p "$staging"
cp {README.md,LICENSE} "$staging/"
if [ "${{ matrix.os }}" = "windows-latest" ]; then
dir
cp target/release/*.exe "$staging/"
7z a "$staging.zip" "$staging"
echo "ASSET=$staging.zip" >> $GITHUB_ENV
else
ls -al target/release/
cp target/release/rust-experiments "$staging/"
tar czf "$staging.tar.gz" "$staging"
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
fi
- name: Upload Release Asset
uses: actions/upload-artifact@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: release-${{ matrix.os }}-${{ matrix.build }}
path: rust-experiments-*
# - name: Download Artifact
# uses: actions/download-artifact@v4
# with:
# name: release-${{ matrix.os }}-${{ matrix.build }}
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
rust-experiments-*.tar.gz
rust-experiments-*.zip
# - name: Create Release
# id: create_release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ github.ref_name }}
# release_name: Release ${{ github.ref_name }}
# draft: false
# prerelease: false
# - name: Upload Release Asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ${{ env.ASSET }}
# asset_name: ${{ env.ASSET }}
# asset_content_type: application/octet-stream
# - name: Find HPI file
# id: find_hpi
# run: |
# hpi_path=$(find . -name "*.hpi" -print -quit)
# hpi_name=$(basename "$hpi_path")
# echo "HPI_PATH=$hpi_path" >> $GITHUB_ENV
# echo "hpi_name=$hpi_name" >> $GITHUB_ENV
# echo "::set-output name=hpi_name::$hpi_name"
#
# - name: Upload Release Asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ${{ env.HPI_PATH }}
# asset_name: ${{ steps.find_hpi.outputs.hpi_name }}
# asset_content_type: application/octet-stream
# upload_url: ${{ github.event.release.upload_url }}
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ${{ env.ASSET }}
# asset_name: ${{ env.ASSET }}
# asset_content_type: application/octet-stream
# - name: Compile and release
# uses: rust-build/rust-build.action@master
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# RUSTTARGET: ${{ matrix.target }}
# EXTRA_FILES: "README.md"
# SRC_DIR: "hello"
# ARCHIVE_TYPES: ${{ matrix.archive }}
# PRE_BUILD: "pre_build.sh"
# POST_BUILD: "test/post_build.sh"
# MINIFY: "yes"
# - uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: stable-${{ matrix.target }}
# target: ${{ matrix.target }}
# default: true
# override: true
# - uses: actions-rs/cargo@v1
# with:
# command: build
# args: --release
# - uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.get_release_info.outputs.upload_url }}
# asset_path: ${{ matrix.asset_path }}
# asset_name: ${{ matrix.asset_name }}
# asset_content_type: application/octet-stream