twistlock 0.0.0-development

Docker <> Rust interface
Documentation
name: Release

env:
  # Use docker.io for Docker Hub if empty
  REGISTRY: ghcr.io
  # github.repository as <account>/<repo>
  IMAGE_NAME: ${{ github.repository }}

concurrency:
  group: "${{ github.workflow }}"
  cancel-in-progress: true # only last step is important, which runs or doesn't

on:
  workflow_dispatch: # releasing is manual as we don't want to release every time

permissions:
  contents: write # to write tags
  packages: write # to write tags to Docker registry
  issues: write
  pull-requests: write

jobs:
  release:
    name: Release
    runs-on: ubuntu-latest
    steps:
      - name: Only on main
        if: github.ref != 'refs/heads/main'
        shell: bash
        run: |
          echo "Only to be executed on main"
          exit 1

      - name: Checkout
        uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
        with:
          token: ${{ secrets.TOKEN_TO_TRIGGER_SUBSEQUENT_WORKFLOWS }}

      - name: Setup Node.js
        uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
        with:
          node-version-file: ".nvmrc"
          cache: "npm"
          cache-dependency-path: "**/package-lock.json"

      - name: Install dependencies
        shell: bash
        run: |
          npm ci --ignore-scripts

      - name: Release
        env:
          GITHUB_TOKEN: ${{ secrets.TOKEN_TO_TRIGGER_SUBSEQUENT_WORKFLOWS }}
        shell: bash
        run: |
          # TODO this release file produces a
          # changelog
          # we want to commit that and defer the release to THAT commit sha
          npm run release