Create pre-release #128
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create pre-release | |
on: | |
workflow_dispatch: | |
inputs: | |
bump: | |
type: choice | |
options: | |
- _ | |
- patch | |
- minor | |
- major | |
required: false | |
prerelease: | |
type: choice | |
options: | |
- _ | |
- withBuildNumber | |
- withoutBuildNumber | |
required: false | |
prelabel: | |
type: choice | |
options: | |
- _ | |
- alpha | |
- beta | |
- rc | |
- snapshot | |
required: false | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
build: | |
if: ${{ github.actor != 'dependabot'}} | |
runs-on: ubuntu-latest | |
outputs: | |
release: ${{ steps.prerelease.outputs.release }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 16.x | |
cache: 'npm' | |
- run: npm install | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 | |
- name: Log in to the Container registry | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Docker Image Locally | |
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 | |
with: | |
context: . | |
file: ./Dockerfile | |
load: true | |
tags: | | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main-enterprise | |
- name: Inspect the Docker Image | |
run: | | |
docker image inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main-enterprise | |
- name: Run Functional Tests | |
id: functionaltest | |
run: | | |
docker run --env APP_ID=${{ secrets.APP_ID }} --env PRIVATE_KEY=${{ secrets.PRIVATE_KEY }} --env WEBHOOK_SECRET=${{ secrets.WEBHOOK_SECRET }} -d -p 3000:3000 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main-enterprise | |
sleep 10 | |
curl http://localhost:3000 | |
- run: echo "${{ github.ref }}" | |
- name: Tag a final release | |
id: prerelease | |
uses: actionsdesk/semver@82aa4310e4e21c59cd0020007a4278e733e81dcb | |
with: | |
bump: ${{ inputs.bump }} | |
prerelease: ${{ inputs.prerelease }} | |
prelabel: ${{ inputs.prelabel }} | |
commitish: ${{ github.ref }} | |
- name: Push Docker Image | |
if: ${{ success() }} | |
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: | | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.prerelease.outputs.release }} | |
platforms: linux/amd64,linux/arm64 | |
provenance: false | |
sbom: false |