From 090afa2f879ae3202dc3fd52c1559c514ba30fc2 Mon Sep 17 00:00:00 2001 From: Jacob McSwain Date: Mon, 27 Nov 2023 01:12:51 -0600 Subject: [PATCH] ci: add release workflow --- .github/workflows/release.yaml | 86 ++++++++++++++++++++++++++++++++++ .gitignore | 1 + 2 files changed, 87 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..3046dd55 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,86 @@ +name: Release + +on: + push: + branches: + - main + tags: + - v* + +concurrency: + group: '${{ github.workflow }} @ ${{ github.ref }}' + cancel-in-progress: false + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Checkout Flatpak repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + branch: flatpak-repository + path: repo + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.12 + - name: Setup GPG + id: gpg + uses: crazy-max/ghaction-import-gpg@v5 + with: + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + git_config_global: true + git_user_signingkey: true + git_commit_gpgsign: true + - name: Install dependencies + run: | + DEBIAN_FRONTEND=noninteractive sudo apt-get update -y + sudo apt-get install --no-install-recommends -y \ + icoutils \ + flatpak \ + flatpak-builder \ + elfutils + flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + - name: Cache Flatpak builder + id: cache-flatpak-builder + uses: actions/cache@v3 + with: + path: .flatpak-builder + key: ${{ runner.os }}-flatpak-builder-${{ hashFiles('com.jagex.Launcher.yaml') }} + - name: Build Flatpak + run: | + ./build.sh sign + # Now we have a com.jagex.Launcher.flatpak file in the root of the repository and an updated repo/ repository. + - name: Create release + id: create-release + uses: actions/create-release@v1 + with: + tag_name: ${{ github.sha }} + release_name: ${{ github.sha }} + draft: false + prerelease: false + - name: Upload Flatpak + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.create-release.outputs.upload_url }} + asset_path: com.jagex.Launcher.flatpak + asset_name: com.jagex.Launcher.flatpak + asset_content_type: application/x-flatpak + - name: Push Flatpak repository + run: | + git config --global user.name "GitHub Actions" + git config --global user.email 'bot@noreply.github.com' + - name: Commit changes to databases + run: | + cd repo + git add -A + git commit --signoff -m "Update com.jagex.Launcher" + git push + env: + GIT_AUTHOR_NAME: ${{ steps.import-gpg.outputs.name }} + GIT_AUTHOR_EMAIL: ${{ steps.import-gpg.outputs.email }} + GIT_COMMITTER_NAME: ${{ steps.import-gpg.outputs.name }} + GIT_COMMITTER_EMAIL: ${{ steps.import-gpg.outputs.email }} diff --git a/.gitignore b/.gitignore index 309d4a66..6e123d25 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ export/ resources/icons/*.png *.flatpak repo/ +bak/