Update actino to do a release #2
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: Build Plugin | |
on: | |
push: | |
branches: | |
- main | |
pull_request_target: | |
branches: ['*'] | |
jobs: | |
build: | |
name: Build plugin | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create variables | |
run: echo "TIMESTAMP=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
fetch-depth: 0 | |
submodules: "recursive" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Append hash to plugin version | |
run: | | |
echo "::notice::This run was triggered by a commit. Appending the commit hash to the plugin version." | |
PACKAGE_FILE="package.json" | |
SHA=$(cut -c1-7 <<< "${{ github.event.pull_request.head.sha || github.sha }}") | |
VERSION=$(jq -r '.version' $PACKAGE_FILE) | |
NEW_VERSION="$VERSION-$SHA" | |
echo "::notice::Going from $VERSION to $NEW_VERSION" | |
tmp=$(mktemp) | |
jq --arg newversion "$NEW_VERSION" '.version = $newversion' $PACKAGE_FILE > $tmp | |
mv $tmp $PACKAGE_FILE | |
echo "::endgroup::" | |
- uses: pnpm/action-setup@v3 | |
- name: Update pnpm lockfile | |
run: | | |
$(which pnpm) install --lockfile-only | |
- name: Download Decky CLI | |
run: | | |
mkdir -p "$(pwd)"/cli | |
curl -L -o "$(pwd)"/cli/decky "https://github.com/SteamDeckHomebrew/cli/releases/latest/download/decky-linux-x86_64" | |
chmod +x "$(pwd)"/cli/decky | |
- name: Build plugin | |
run: | | |
# Run the CLI as root to get around Docker's weird permissions | |
sudo .vscode/build.sh | |
sudo chown -R $(whoami) out | |
- name: Unzip plugin | |
run: | | |
for file in out/*.zip; do | |
echo "Unzipping $file" | |
unzip -qq "$file" -d out | |
done | |
tree out | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: output | |
path: out/*/ | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ env.TIMESTAMP }} | |
prerelease: true | |
files: out/*.zip |