Skip to content

Merge pull request #49 from davincios/feature/stdout-capture #130

Merge pull request #49 from davincios/feature/stdout-capture

Merge pull request #49 from davincios/feature/stdout-capture #130

name: Release
on:
push:
tags:
- "v*"
jobs:
create-release:
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v4
- name: Update version in Cargo.toml
run: |
if [[ "${{github.ref_name}}" == *"-dev" ]] ; then
export TRACER_VERSION_DEVELOP="${{github.ref_name}}"
sed -i.bak "s/^version = .*/version = \"${TRACER_VERSION_DEVELOP:0:$((${#TRACER_VERSION_DEVELOP} - 4))}\"/" Cargo.toml
sed -i.bak "s/^version = \"v/version = \"/" Cargo.toml
sed -i.bak "s/^TRACER_VERSION_DEVELOP=\".*/TRACER_VERSION_DEVELOP=\"${{github.ref_name}}\"/" install-tracer.sh
else
sed -i.bak "s/^version = .*/version = \"${{github.ref_name}}\"/" Cargo.toml
sed -i.bak "s/^version = \"v/version = \"/" Cargo.toml
sed -i.bak "s/^TRACER_VERSION=\".*/TRACER_VERSION=\"${{github.ref_name}}\"/" install-tracer.sh
fi
- name: Setup Github user
run: git config --local user.name actions-user
- run: git config --local user.email "actions@github.com"
- name: Add files to commit
run: git add Cargo.toml install-tracer.sh
- name: Commit changes
run: git commit -m "Update version to ${{github.ref_name}}"
- name: Push changes
run: git push origin HEAD:main
- uses: taiki-e/create-gh-release-action@v1.8.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
upload-assets:
needs: create-release
permissions: write-all
strategy:
matrix:
include:
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: universal-apple-darwin
os: macos-latest
# - target: x86_64-pc-windows-msvc
# os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- name: Set Perl environment variables
if: runner.os == 'Windows'
run: |
echo "PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
echo "OPENSSL_SRC_PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- uses: actions/checkout@v4
- name: Update version in Cargo.toml # The tagged commit is still an old one
run: |
if [[ "${{github.ref_name}}" == *"-dev" ]] ; then
export TRACER_VERSION_DEVELOP="${{github.ref_name}}"
sed -i.bak "s/^version = .*/version = \"${TRACER_VERSION_DEVELOP:0:$((${#TRACER_VERSION_DEVELOP} - 4))}\"/" Cargo.toml
sed -i.bak "s/^version = \"v/version = \"/" Cargo.toml
sed -i.bak "s/^TRACER_VERSION_DEVELOP=\".*/TRACER_VERSION_DEVELOP=\"${{github.ref_name}}\"/" install-tracer.sh
else
sed -i.bak "s/^version = .*/version = \"${{github.ref_name}}\"/" Cargo.toml
sed -i.bak "s/^version = \"v/version = \"/" Cargo.toml
sed -i.bak "s/^TRACER_VERSION=\".*/TRACER_VERSION=\"${{github.ref_name}}\"/" install-tracer.sh
fi
- name: Install cross-compilation tools
uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target }}
if: startsWith(matrix.os, 'ubuntu')
- uses: taiki-e/upload-rust-binary-action@v1
with:
# (required) Comma-separated list of binary names (non-extension portion of filename) to build and upload.
# Note that glob pattern is not supported yet.
bin: tracer
# (optional) Target triple, default is host triple.
target: ${{ matrix.target }}
# (required) GitHub token for uploading assets to GitHub Releases.
token: ${{ secrets.GITHUB_TOKEN }}