mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
112 lines
3.0 KiB
YAML
112 lines
3.0 KiB
YAML
name: Auto Release & Publish
|
|
|
|
#on:
|
|
# pull_request:
|
|
# types: [ closed ]
|
|
# branches:
|
|
# - main
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- '*.*.*'
|
|
- '!*-*'
|
|
|
|
permissions:
|
|
contents: write
|
|
packages: write
|
|
|
|
jobs:
|
|
create-release:
|
|
if: github.event.pull_request.merged == true
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
draft_tag: ${{ steps.release_step.outputs.draft_tag }}
|
|
version: ${{ steps.release_step.outputs.version }}
|
|
steps:
|
|
- uses: actions/create-github-app-token@v1
|
|
id: app-token
|
|
with:
|
|
app-id: ${{ vars.APP_ID }}
|
|
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
|
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ steps.app-token.outputs.token }}
|
|
ref: main
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "lts/*"
|
|
cache: "pnpm"
|
|
|
|
- run: pnpm install --frozen-lockfile
|
|
|
|
- run: |
|
|
git config --global user.name 'github-actions[bot]'
|
|
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
|
|
|
|
|
- name: Run release-it
|
|
id: release_step
|
|
run: |
|
|
git pull origin main
|
|
|
|
|
|
VERSION=$(pnpm exec release-it --ci --release-version)
|
|
echo "version=$VERSION"
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
OUTPUT=$(pnpm exec release-it --ci --release-version)
|
|
echo "$OUTPUT"
|
|
DRAFT_TAG=$(echo "$OUTPUT" | grep -o 'releases/tag/[^ ]*' | sed 's|releases/tag/||')
|
|
echo "draft_tag=$DRAFT_TAG" >> $GITHUB_OUTPUT
|
|
env:
|
|
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
|
|
|
publish-docker:
|
|
needs: create-release
|
|
uses: ./.github/workflows/docker.yml
|
|
with:
|
|
version: ${{ needs.create-release.outputs.version }}
|
|
add_latest: true
|
|
secrets:
|
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME_2 }}
|
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD_2 }}
|
|
|
|
finalize-release:
|
|
needs: publish-docker
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
release_tag: ${{ steps.publish_release_step.outputs.release_tag }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Publish GitHub Release
|
|
id: publish_release_step
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
OUTPUT=$(gh release edit ${{ needs.create-release.outputs.draft_tag }} --draft=false)
|
|
echo "$OUTPUT"
|
|
RELEASE_TAG=$(echo "$OUTPUT" | sed -E 's|.*/releases/tag/||')
|
|
echo "release_tag=$RELEASE_TAG" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
notify-discord:
|
|
needs: finalize-release
|
|
uses: ./.github/workflows/discord.yml
|
|
with:
|
|
release_tag: ${{ needs.create-release.outputs.draft_tag }}
|
|
discord_title: "New Release"
|
|
discord_color: 3066993
|
|
discord_footer: "Portabase"
|
|
secrets:
|
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |