Update Chocolatey #271
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: Update Chocolatey | |
on: | |
schedule: | |
- cron: "0 18 * * *" | |
workflow_dispatch: | |
inputs: | |
force: | |
description: "Force push package?" | |
required: false | |
default: "false" | |
jobs: | |
check: | |
name: Get Version | |
runs-on: ubuntu-latest | |
outputs: | |
update_needed: ${{ steps.check.outputs.update_needed }} | |
latest_version: ${{ steps.check.outputs.latest_version }} | |
current_version: ${{ steps.check.outputs.current_version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get version | |
id: check | |
run: | | |
latest_version=$(curl https://version.surrealdb.com) | |
current_version=$(cat current.version) | |
if [[ "$latest_version" = "$current_version" ]]; then | |
update_needed='false' | |
else | |
update_needed='true' | |
fi | |
echo "Latest version: $latest_version" | |
echo "Current version: $current_version" | |
echo "Update needed: $update_needed" | |
echo "update_needed=$update_needed" >> $GITHUB_OUTPUT | |
echo "latest_version=$latest_version" >> $GITHUB_OUTPUT | |
echo "current_version=$current_version" >> $GITHUB_OUTPUT | |
update: | |
needs: check | |
name: Update Chocolatey | |
if: ${{ github.event.inputs.force == 'true' || needs.check.outputs.update_needed == 'true' }} | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: powershell | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install tooling | |
run: | | |
choco install au checksum -y | |
- name: Build package | |
working-directory: . | |
run: | | |
./patch.ps1 | |
env: | |
au_Push: "false" | |
au_Force: ${{ github.event.inputs.force }} | |
SURREALDB_VERSION: ${{ needs.check.outputs.latest_version }} | |
- name: Install package | |
working-directory: . | |
run: Test-Package $Install | |
- name: Check SurrealDB version | |
run: | | |
tools/surreal.exe version | |
- name: Push package to Chocolatey | |
run: Push-Package | |
working-directory: . | |
env: | |
api_key: ${{ secrets.CHOCOLATEY_API_KEY }} | |
au_Force: ${{ github.event.inputs.force }} | |
- name: Commit repository changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: "[GitHub Actions] Updating SurrealDB on Chocolatey ${{ needs.check.outputs.latest_version }}" | |
add: "." | |
cwd: "." |