mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-02 07:53:55 +03:00
136 lines
5.1 KiB
YAML
136 lines
5.1 KiB
YAML
name: "Publish"
|
|
on:
|
|
workflow_run:
|
|
workflows: ["Nightly build"]
|
|
types:
|
|
- completed
|
|
|
|
workflow_dispatch:
|
|
inputs:
|
|
channel:
|
|
type: choice
|
|
required: true
|
|
description: channel
|
|
options:
|
|
- release
|
|
- nightly
|
|
bump:
|
|
type: choice
|
|
required: true
|
|
description: update type
|
|
options:
|
|
- undefined
|
|
- patch
|
|
- minor
|
|
- major
|
|
|
|
jobs:
|
|
publish-tauri:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
platform:
|
|
- 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
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: 7.x.x
|
|
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
|
|
# do not cache pnpm on our runners (internet in berlin is very slow)
|
|
if: matrix.platform != 'macos-aarch64'
|
|
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: Install latest stable rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: true
|
|
|
|
- name: Cache rust dependencies
|
|
# do not cache rust on our runners (internet in berlin is very slow)
|
|
if: matrix.platform != 'macos-aarch64'
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: src-tauri
|
|
|
|
- name: Set nightly params
|
|
if: ${{ !!github.event.workflow_run }}
|
|
run: |
|
|
echo "channel=nightly" >> $GITHUB_ENV
|
|
echo "bump=patch" >> $GITHUB_ENV
|
|
|
|
- name: Use input params
|
|
if: ${{ !github.event.workflow_run }}
|
|
run: |
|
|
echo "channel=${{ github.event.inputs.channel }}" >> $GITHUB_ENV
|
|
echo "bump=${{ github.event.inputs.bump }}" >> $GITHUB_ENV
|
|
|
|
- name: Set env variable with version
|
|
run: |
|
|
CURRENT_VERSION="$(curl --silent "https://app.gitbutler.com/releases/${{ env.channel }}" | jq -r '.version')"
|
|
NEXT_VERSION=$(./scripts/next.sh "${CURRENT_VERSION}" "${{ env.bump }}")
|
|
echo "version=$NEXT_VERSION" >> $GITHUB_ENV
|
|
|
|
- name: Build binary
|
|
run: |
|
|
./scripts/release.sh \
|
|
--sign \
|
|
--channel "${{ env.channel }}" \
|
|
--dist "./release" \
|
|
--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.channel }}/${{ env.version }}-${{ github.run_number }}"
|
|
|
|
# tell our server to update with the version number
|
|
- name: Tell our server to update
|
|
run: |
|
|
curl 'https://app.gitbutler.com/api/releases' \
|
|
--fail \
|
|
--request POST \
|
|
--header 'Content-Type: application/json' \
|
|
--header 'X-Auth-Token: ${{ secrets.BOT_AUTH_TOKEN }}' \
|
|
--data '{"channel":"${{ env.channel }}","version":"${{ env.version }}-${{ github.run_number }}","sha":"${{ github.sha }}"}'
|