v1.4.0 #9
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
# Runs on push to main, basically the "release" version since we don't really do releases (that's bad right) | |
name: Cargo Release | |
on: | |
release: | |
types: published | |
jobs: | |
build: | |
permissions: | |
contents: write # This is required to upload the release assets | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macOS-13] | |
include: | |
- os: ubuntu-latest | |
file-name: qpm | |
prefix: linux-x64 | |
arch: x64 | |
- os: macOS-13 | |
file-name: qpm | |
prefix: macos-x64 | |
arch: x64 | |
- os: windows-latest | |
file-name: qpm.exe | |
prefix: windows-x64 | |
arch: x64 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Extract current tag | |
if: startsWith(github.ref, 'refs/tags/v') | |
id: extract_tag | |
run: | | |
# Get the current tag | |
$TAG = git tag --points-at HEAD | |
Write-Output "Current tag: $TAG" | |
# Strip the first letter to get the version | |
$VERSION = $TAG.Substring(1) | |
Write-Output "Extracted version: $VERSION" | |
# Set the outputs | |
"tag=$TAG" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 | |
"version=$VERSION" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 | |
shell: pwsh | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Get libdbus if Ubuntu | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
sudo apt-get install -y libdbus-1-dev | |
- name: Cargo build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release | |
- name: Cargo test | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --release | |
- name: Compress build | |
run: | | |
pwsh -Command Compress-Archive ./target/release/${{matrix.file-name}} -DestinationPath qpm-${{matrix.prefix}}.zip | |
- name: Upload Release Assets | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
qpm-${{matrix.prefix}}.zip | |
# MacOS Universal binaries | |
- uses: actions-rs/toolchain@v1 | |
if: ${{matrix.os == 'macos-13' }} | |
with: | |
toolchain: nightly | |
target: aarch64-apple-darwin | |
- name: Double check | |
if: ${{ matrix.os == 'macos-13' }} | |
run: | | |
rustup target add aarch64-apple-darwin | |
rustup show | |
- name: Cargo build for aarch64 Mac | |
if: ${{matrix.os == 'macos-13' }} | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release --target aarch64-apple-darwin | |
- name: Make M1 Universal binary | |
if: ${{matrix.os == 'macos-13' }} | |
run: | | |
lipo -create -output qpm target/release/${{matrix.file-name}} target/aarch64-apple-darwin/release/${{matrix.file-name}} | |
pwsh -Command Compress-Archive qpm -DestinationPath qpm-macos-universal.zip | |
- name: Artifact Upload | |
if: ${{matrix.os == 'macos-13' }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: qpm-macos-universal.zip | |
# TODO: Move to somewhere else | |
- name: Download Inno Setup | |
uses: suisei-cn/actions-download-file@v1 | |
if: ${{matrix.os == 'windows-latest' }} | |
with: | |
url: https://jrsoftware.org/download.php/is.exe | |
target: ../ | |
- name: Install Inno Setup | |
if: ${{matrix.os == 'windows-latest' }} | |
run: "../is.exe /VERYSILENT /NORESTART /ALLUSERS" | |
- name: Compile Installer | |
if: ${{matrix.os == 'windows-latest' }} | |
run: '& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "/DMyAppVersion=${{ steps.extract_tag.outputs.version }}" /f installer/installer.iss' | |
- name: Upload Installer Assets | |
if: ${{matrix.os == 'windows-latest' }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ./installer/qpm-installer.exe | |
winget: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Check if WINGET_TOKEN is present | |
id: check_secret | |
run: | | |
if [ -z "${{ secrets.WINGET_TOKEN }}" ]; then | |
echo "WINGET_TOKEN is not set" | |
echo "winget_token_present=false" >> $GITHUB_ENV | |
else | |
echo "WINGET_TOKEN is present" | |
echo "winget_token_present=true" >> $GITHUB_ENV | |
fi | |
- name: Submit to winget | |
id: winget_deploy | |
uses: vedantmgoyal9/winget-releaser@main | |
if: ${{ env.winget_token_present == 'true' }} | |
with: | |
identifier: QuestPackageManager.QuestPackageManager | |
installers-regex: 'installer\.exe$' | |
fork-user: ${{ secrets.WINGET_FORK_USER }} | |
token: ${{ secrets.WINGET_TOKEN }} |