gitbutler/.github/workflows/publish.yaml

104 lines
3.9 KiB
YAML
Raw Normal View History

2023-02-08 17:51:52 +03:00
name: "Publish"
2023-02-03 12:36:51 +03:00
on:
2023-02-17 16:21:41 +03:00
workflow_dispatch:
inputs:
2023-02-20 16:57:58 +03:00
bump:
2023-02-17 16:21:41 +03:00
type: choice
2023-02-20 16:53:34 +03:00
required: true
2023-02-20 16:57:58 +03:00
description: update type
2023-02-17 16:21:41 +03:00
options:
- undefined
2023-02-17 16:21:41 +03:00
- patch
- minor
- major
2023-02-03 12:36:51 +03:00
jobs:
publish-tauri:
strategy:
fail-fast: false
matrix:
platform:
2023-03-17 09:53:46 +03:00
- macos-latest
- macos-aarch64
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
2023-02-28 10:59:02 +03:00
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 7.x.x
2023-02-28 10:59:02 +03:00
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install pnpm dependencies
run: pnpm install
- name: Setup rust
uses: dtolnay/rust-toolchain@stable
2023-02-28 10:42:21 +03:00
- name: Cache rust dependencies
2023-03-28 16:30:07 +03:00
uses: Swatinem/rust-cache@v2
2023-02-28 10:42:21 +03:00
with:
2023-03-28 16:30:07 +03:00
workspaces: src-tauri
2023-02-28 10:42:21 +03:00
2023-02-17 16:21:41 +03:00
- name: Set env variable with version
run: |
CURRENT_VERSION="$(curl --silent "https://app.gitbutler.com/releases" | jq -r '.version')"
2023-02-20 17:21:27 +03:00
NEXT_VERSION=$(./scripts/next.sh "${CURRENT_VERSION}" "${{ github.event.inputs.bump }}")
echo "version=$NEXT_VERSION" >> $GITHUB_ENV
2023-02-17 16:21:41 +03:00
- name: Build binary
run: |
./scripts/release.sh \
--sign \
--dist "./release" \
2023-02-17 16:21:41 +03:00
--version "${{ env.version }}" \
--tauri-private-key "${{ secrets.TAURI_PRIVATE_KEY }}" \
--tauri-key-password "${{ secrets.TAURI_KEY_PASSWORD }}" \
--apple-certificate "${{ secrets.APPLE_CERTIFICATE }}" \
--apple-certificate-password "${{ secrets.APPLE_CERTIFICATE_PASSWORD }}" \
--apple-signing-identity "${{ secrets.APPLE_SIGNING_IDENTITY }}" \
--apple-id "${{ secrets.APPLE_ID }}" \
--apple-password "${{ secrets.APPLE_PASSWORD }}"
- uses: shallwefootball/s3-upload-action@master
name: Upload To S3
id: S3
with:
aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
aws_bucket: "releases.gitbutler.com"
source_dir: "release/"
destination_dir: "releases/${{ env.version }}-${{ github.run_number }}"
# tell our server to update with the version number
- name: Tell our server to update
run: |
2023-02-17 14:46:13 +03:00
curl 'https://app.gitbutler.com/api/releases' \
2023-02-20 19:13:49 +03:00
--fail \
2023-02-17 14:46:13 +03:00
--request POST \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: ${{ secrets.BOT_AUTH_TOKEN }}' \
2023-03-23 10:00:07 +03:00
--data '{"version":"${{ env.version }}-${{ github.run_number }}","sha":"${{ github.sha }}"}'