Serverless Satis

s3-satis build GitHub Action

GitHub Action to build and publish Composer repository to S3 bucket using CLI tool s3-satis.

To ease the process of building and publishing Composer repository to S3 bucket, in fully serverless manner, this GitHub Action was created.

Usage

In your workflow file, add following step:

name: Main

on: push

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Build Satis Repo
        uses: kduma-OSS/GH-build-s3-satis-action@v2
        with:
          s3-access-key-id: ${{ secrets.S3_ACCESS_KEY_ID }}
          s3-secret-access-key: ${{ secrets.S3_SECRET_ACCESS_KEY }}
          s3-region: ${{ vars.S3_REGION }}
          s3-bucket: ${{ vars.S3_BUCKET }}
          s3-endpoint: ${{ vars.S3_ENDPOINT }}

Configuration options

OptionDescriptionTypeRequiredDefault
satis-config-pathPath to satis.json filestringNosatis.json
s3-satis-version-tagDocker image version tag to usestringNov0
repository-urlURL of repository to updatestringNo
verbosityVerbosity level of satisnormal or verbose or very_verboseNonormal
use-cacheUse cache for satisbooleanNofalse
freshForce satis to rebuild repositorybooleanNofalse
cache-pathPath to cache directorystringNosatis-cache
s3-access-key-idS3 access key IDstringYes
s3-secret-access-keyS3 secret access keystringYes
s3-regionS3 regionstringNo
s3-bucketS3 bucketstringYes
s3-endpointS3 endpointstringNo
s3-use-path-style-endpointS3 use path style endpointbooleanNofalse
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Build Satis Repo
        uses: kduma-OSS/GH-build-s3-satis-action@v2
        with:
          satis-config-path: satis.json
          s3-satis-version-tag: v0
          repository-url:
          verbosity: normal
          use-cache: false
          fresh: false
          cache-path: satis-cache
          s3-access-key-id: 
          s3-secret-access-key: 
          s3-region: 'us-east-1'
          s3-bucket: 
          s3-endpoint: 
          s3-use-path-style-endpoint: false

Usage with cache

To use cache, you need to add actions/cache step before s3-satis step and set use-cache option to true. It uses cache extension of s3-satis tool.

name: Main

on: push

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Satis Cache
        uses: actions/cache@v3
        with:
            path: satis-cache
            key: satis-${{ runner.os }}-${{ github.run_id }}
            restore-keys: satis-${{ runner.os }}
      - name: Build Satis Repo
        uses: kduma-OSS/GH-build-s3-satis-action@v2
        with:
          use-cache: true
          s3-access-key-id: ${{ secrets.S3_ACCESS_KEY_ID }}
          s3-secret-access-key: ${{ secrets.S3_SECRET_ACCESS_KEY }}
          s3-region: ${{ vars.S3_REGION }}
          s3-bucket: ${{ vars.S3_BUCKET }}
          s3-endpoint: ${{ vars.S3_ENDPOINT }}

Usage with private repositories

Satis uses your composer configuration to download packages, so if you want to use private repositories, you need to configure composer authentication. For details check Composer documentation. If you want to set GitHub access token in composer, add a step before s3-satis step to add a token.

name: Main

on: push

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Configure composer auth
        run: composer config -g github-oauth.github.com ${{secrets.COMPOSER_GITHUB_TOKEN}}
      - name: Build Satis Repo
        uses: kduma-OSS/GH-build-s3-satis-action@v2
        with:
          s3-access-key-id: ${{ secrets.S3_ACCESS_KEY_ID }}
          s3-secret-access-key: ${{ secrets.S3_SECRET_ACCESS_KEY }}
          s3-region: ${{ vars.S3_REGION }}
          s3-bucket: ${{ vars.S3_BUCKET }}
          s3-endpoint: ${{ vars.S3_ENDPOINT }}