mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
📎 Improve gh actions
This commit is contained in:
105
.github/workflows/build-bundles.yml
vendored
105
.github/workflows/build-bundles.yml
vendored
@@ -1,28 +1,14 @@
|
|||||||
name: Build and Upload Penpot Bundles non-prod
|
name: Build and Upload Penpot Bundles
|
||||||
|
|
||||||
on:
|
on:
|
||||||
# Create bundler for every tag
|
# Create bundle from manual action
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- '**' # Pattern matched against refs/tags
|
|
||||||
# Create bundler every hour between 5:00 and 20:00 on working days
|
|
||||||
schedule:
|
|
||||||
- cron: '0 5-20 * * 1-5'
|
|
||||||
# Create bundler from manual action
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
zip_mode:
|
gh_ref:
|
||||||
# zip_mode defines how the build artifacts are packaged:
|
description: 'Name of the branch'
|
||||||
# - 'individual': creates one ZIP file per component (frontend, backend, exporter)
|
type: string
|
||||||
# - 'all': creates a single ZIP containing all components
|
required: true
|
||||||
# - null: for the rest of cases (non-manual events)
|
|
||||||
description: 'Bundle packaging mode'
|
|
||||||
required: false
|
|
||||||
default: 'individual'
|
|
||||||
type: choice
|
|
||||||
options:
|
|
||||||
- individual
|
|
||||||
- all
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-bundles:
|
build-bundles:
|
||||||
@@ -38,15 +24,15 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
ref: ${{ inputs.gh_ref }}
|
||||||
|
|
||||||
- name: Extract somer useful variables
|
- name: Extract some useful variables
|
||||||
id: vars
|
id: vars
|
||||||
run: |
|
run: |
|
||||||
echo "commit_hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
echo "commit_hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||||
echo "gh_branch=${{ github.base_ref || github.ref_name }}" >> $GITHUB_OUTPUT
|
echo "gh_branch=${{ github.base_ref || github.ref_name }}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
# Set up Docker Buildx for multi-arch build
|
- name: Set up Docker Buildx for multi-arch build
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Run manage.sh build-bundle from host
|
- name: Run manage.sh build-bundle from host
|
||||||
@@ -57,73 +43,22 @@ jobs:
|
|||||||
mkdir zips
|
mkdir zips
|
||||||
mv bundles penpot
|
mv bundles penpot
|
||||||
|
|
||||||
- name: Create zip bundles for zip_mode == 'all'
|
- name: Create zip bundles
|
||||||
if: ${{ github.event.inputs.zip_mode == 'all' }}
|
|
||||||
run: |
|
run: |
|
||||||
echo "📦 Packaging Penpot 'all' bundles..."
|
echo "📦 Packaging Penpot bundles..."
|
||||||
zip -r zips/penpot-all-bundles.zip penpot
|
zip -r zips/penpot.zip penpot
|
||||||
|
|
||||||
- name: Create zip bundles for zip_mode != 'all'
|
- name: Upload Penpot bundle to S3
|
||||||
if: ${{ github.event.inputs.zip_mode != 'all' }}
|
|
||||||
run: |
|
run: |
|
||||||
echo "📦 Packaging Penpot 'individual' bundles..."
|
aws s3 cp zips/penpot.zip s3://${{ secrets.S3_BUCKET }}/penpot-${{ steps.vars.outputs.gh_branch}}-latest.zip
|
||||||
zip -r zips/penpot-frontend.zip penpot/frontend
|
aws s3 cp zips/penpot.zip s3://${{ secrets.S3_BUCKET }}/penpot-${{ steps.vars.outputs.commit_hash }}.zip
|
||||||
zip -r zips/penpot-backend.zip penpot/backend
|
|
||||||
zip -r zips/penpot-exporter.zip penpot/exporter
|
|
||||||
|
|
||||||
- name: Upload unified 'all' bundle
|
- name: Notify Mattermost
|
||||||
if: ${{ github.event.inputs.zip_mode == 'all' }}
|
if: failure()
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: penpot-all-bundles
|
|
||||||
path: zips/penpot-all-bundles.zip
|
|
||||||
|
|
||||||
- name: Upload individual bundles
|
|
||||||
if: ${{ github.event.inputs.zip_mode != 'all' }}
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: penpot-individual-bundles
|
|
||||||
path: |
|
|
||||||
zips/penpot-frontend.zip
|
|
||||||
zips/penpot-backend.zip
|
|
||||||
zips/penpot-exporter.zip
|
|
||||||
|
|
||||||
- name: Upload unified 'all' bundle to S3
|
|
||||||
if: ${{ github.event.inputs.zip_mode == 'all' }}
|
|
||||||
run: |
|
|
||||||
aws s3 cp zips/penpot-all-bundles.zip s3://${{ secrets.S3_BUCKET }}/penpot-all-bundles-${{ steps.vars.outputs.gh_branch}}.zip
|
|
||||||
aws s3 cp zips/penpot-all-bundles.zip s3://${{ secrets.S3_BUCKET }}/penpot-all-bundles-${{ steps.vars.outputs.commit_hash }}.zip
|
|
||||||
|
|
||||||
- name: Upload 'individual' bundles to S3
|
|
||||||
if: ${{ github.event.inputs.zip_mode != 'all' }}
|
|
||||||
run: |
|
|
||||||
for name in penpot-frontend penpot-backend penpot-exporter; do
|
|
||||||
aws s3 cp zips/${name}.zip s3://${{ secrets.S3_BUCKET }}/${name}-${{ steps.vars.outputs.gh_branch }}-latest.zip
|
|
||||||
aws s3 cp zips/${name}.zip s3://${{ secrets.S3_BUCKET }}/${name}-${{ steps.vars.outputs.commit_hash }}.zip
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Notify Mattermost about automatic bundles
|
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
uses: mattermost/action-mattermost-notify@master
|
uses: mattermost/action-mattermost-notify@master
|
||||||
with:
|
with:
|
||||||
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK }}
|
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK }}
|
||||||
TEXT: |
|
TEXT: |
|
||||||
📦 *Penpot bundle automatically generated*
|
❌ *[PENPOT] Error during the execution of the job*
|
||||||
📄 PR: ${{ github.event.pull_request.title }}
|
📄 Triggered from ref: `${{ steps.vars.outputs.gh_branch}}`
|
||||||
🔁 From: \`${{ github.head_ref }}\` to \`{{ github.base_ref }}\`
|
|
||||||
🔗 Run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
🔗 Run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||||
|
|
||||||
- name: Notify Mattermost about manual bundles
|
|
||||||
if: github.event_name == 'workflow_dispatch'
|
|
||||||
uses: mattermost/action-mattermost-notify@master
|
|
||||||
with:
|
|
||||||
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK }}
|
|
||||||
TEXT: |
|
|
||||||
📦 *Penpot bundle manually generated*
|
|
||||||
📄 Triggered from branch: `${{ github.ref_name}}`
|
|
||||||
🔗 Run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
||||||
|
|
||||||
- name: Print artifact summary URL
|
|
||||||
run: |
|
|
||||||
echo "📦 Artifacts available at:"
|
|
||||||
echo "🔗 https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
|
||||||
|
|||||||
12
.github/workflows/build-develop.yml
vendored
Normal file
12
.github/workflows/build-develop.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
name: Build and Upload Penpot DEVELOP Bundles
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '16 5-20 * * 1-5'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-develop-bundle:
|
||||||
|
uses: ./.github/workflows/build-bundles.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
gh_ref: "develop"
|
||||||
12
.github/workflows/build-staging.yml
vendored
Normal file
12
.github/workflows/build-staging.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
name: Build and Upload Penpot STAGING Bundles
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 5 * * 1-5'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-staging-bundle:
|
||||||
|
uses: ./.github/workflows/build-bundles.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
gh_ref: "staging"
|
||||||
Reference in New Issue
Block a user