Skip to content

Shared build pipeline for plugins on GitHub and Bitbucket

Notifications You must be signed in to change notification settings

TangibleInc/pipeline

Repository files navigation

Pipeline

Shared build pipeline for plugins on GitHub and Bitbucket.

Source code: https://github.com/tangibleinc/pipeline

Features

The goal is to seamlessly upgrade from the previous Bitbucket Pipeline v2 to GitHub Actions.

  • Create zip archive

    • {plugin}-latest.zip on Git commit - branch main or master
    • {plugin}-{branch}-latest.zip on Git commit - other branches
    • {plugin}-{version}.zip on Git version tag
  • Copy zip file to release on project page

    • Releases folder on GitHub
    • Downloads folder on BitBucket
  • Copy zip file to update server

    • On version release, publish to update server
    • On every commit, publish preview release with optional branch suffix
  • Create change log from Git commit messages

  • Deploy metadata to an event API

Bitbucket Pipeline

Create a file named bitbucket-pipelines.yml.

# See https://github.com/tangibleinc/pipeline
image: php:8.1-fpm
pipelines:
  # On every commit
  default:
    - step:
        script:
          - curl -sL "https://${BB_AUTH_STRING}@api.bitbucket.org/2.0/repositories/tangibleinc/tangible-pipeline-v3/downloads/run" | bash
  # On every version tag
  tags:
    "*":
      - step:
          script:
            - curl -sL "https://${BB_AUTH_STRING}@api.bitbucket.org/2.0/repositories/tangibleinc/tangible-pipeline-v3/downloads/run" | bash

For existing projects, change v2 to v3 in the URL of the Bitbucket pipeline script.

Alternatively use the GitHub URL.

https://raw.githubusercontent.com/tangibleinc/pipeline/main/run

GitHub Actions

Status: Work in progress

Create a file at .github/workflows/release.yml.

name: Release
permissions:
  contents: write
on: push
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Setup Bun
        uses: oven-sh/setup-bun@v2
      - name: Install dependencies
        run: bun install
      - name: Create archive
        run: bunx roll archive -y
      - name: Install pipeline
        run: mkdir -p publish && cd publish && git clone https://github.com/tangibleinc/pipeline
      - name: Add latest tag as needed
        uses: EndBug/latest-tag@latest
        if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
      - name: Before release script
        run: bun run publish/pipeline/before-release.ts
      - name: Release tag
        uses: softprops/action-gh-release@v2
        if: ${{ startsWith(github.ref, 'refs/tags/') }}
        with:
          body_path: publish/release.md
          files: publish/*.zip
      - name: Release preview at latest commit
        uses: softprops/action-gh-release@v2
        if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
        with:
          body_path: publish/release.md
          files: publish/*.zip
          tag_name: latest
          make_latest: true
      - name: After release script
        run: bun run publish/pipeline/after-release.ts

Actions reference

Private repositories

To give the pipeline access to private repositories, refer to:

Use GitHub Action ssh-agent to pass one or more private keys.

- uses: webfactory/[email protected]
  with:
      ssh-private-key: ${{ secrets.TANGIBLE_PIPELINE_SSH_KEY }}

About

Shared build pipeline for plugins on GitHub and Bitbucket

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published