mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-11-30 11:32:04 +03:00
131 lines
4.5 KiB
YAML
131 lines
4.5 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
|
|
- [self-hosted, macOS, ARM64] # mac studio in berlin
|
|
- ubuntu-20.04
|
|
# uncomment when this is solved: https://github.com/tauri-apps/tauri/issues/4174
|
|
# - [self-hosted, Linux, ARM64] # mac studio in berlin
|
|
|
|
runs-on: ${{ matrix.platform }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/actions/init-env-rust
|
|
- uses: ./.github/actions/init-env-node
|
|
|
|
- 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: import gpg key
|
|
if: runner.os == 'Linux'
|
|
uses: crazy-max/ghaction-import-gpg@v6
|
|
with:
|
|
gpg_private_key: ${{ secrets.APPIMAGE_PRIVATE_KEY }}
|
|
passphrase: ${{ secrets.APPIMAGE_KEY_PASSPHRASE }}
|
|
|
|
- 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-team-id "${{ secrets.APPLE_PROVIDER_SHORT_NAME }}" \
|
|
--apple-password "${{ secrets.APPLE_PASSWORD }}" \
|
|
--appimage-key-id "${{ secrets.APPIMAGE_KEY_ID }}" \
|
|
--appimage-key-passphrase "${{ secrets.APPIMAGE_KEY_PASSPHRASE }}"
|
|
|
|
- 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 }}"}'
|
|
|
|
- name: Tag release
|
|
env:
|
|
TAG_NAME: "${{ env.channel }}/${{ env.version }}"
|
|
run: |
|
|
function tag_exists() {
|
|
git tag --list | grep -q "^$1$"
|
|
}
|
|
function fetch_tag() {
|
|
git fetch origin "refs/tags/$1:refs/tags/$1"
|
|
}
|
|
function delete_tag() {
|
|
git push --delete origin "$1"
|
|
}
|
|
function create_tag() {
|
|
git tag --force "$1"
|
|
git push --tags
|
|
}
|
|
|
|
fetch_tag "$TAG_NAME" || true
|
|
if tag_exists "$TAG_NAME"; then
|
|
delete_tag "$TAG_NAME"
|
|
fi
|
|
create_tag "$TAG_NAME"
|