Skip to content

Trigger build workflow in merge queue #29

Trigger build workflow in merge queue

Trigger build workflow in merge queue #29

Workflow file for this run

name: Build
on:
push:
branches: [ main ]
pull_request:
merge_group:
jobs:
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.gitversion.outputs.semVer }}
steps:
- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Use GitVersion
id: gitversion # step id used as reference for output values
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
showConfig: true
configFilePath: ./GitVersion.yml
- name: Display SemVer
run: |
echo "SemVer: ${{ steps.gitversion.outputs.semVer }}"
release:
runs-on: ubuntu-latest
needs: version
if: github.event_name != 'pull_request'
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ needs.version.outputs.version }}
release_name: fireapp-${{ needs.version.outputs.version }}
draft: false
prerelease: false
- name: Create Backend ZIP deployment package
run: zip -r fireapp-${{ needs.version.outputs.version }}.zip . [email protected];
- name: Upload ZIP as Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./fireapp-${{ needs.version.outputs.version }}.zip
asset_name: fireapp-${{ needs.version.outputs.version }}.zip
asset_content_type: application/zip
docker:
runs-on: ubuntu-latest
needs: version
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Lowercase Repository
run: |
echo "REPOSITORY_LC=${REPOSITORY,,}" >> ${GITHUB_ENV}
env:
REPOSITORY: '${{ github.repository }}'
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ env.REPOSITORY_LC }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: https://ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: |
if [[ "${{ github.event_name != 'pull_request' }}" == "true" ]]; then
echo "TAGS=${{ steps.meta.outputs.tags }}
ghcr.io/${{ env.REPOSITORY_LC }}:latest
ghcr.io/${{ env.REPOSITORY_LC }}:${{ needs.version.outputs.version }}" >> $GITHUB_ENV
else
echo "TAGS=ghcr.io/${{ env.REPOSITORY_LC }}:${{ needs.version.outputs.version }}" >> $GITHUB_ENV
fi
id: tag
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64, linux/arm64, linux/riscv64, linux/arm/v7, linux/arm/v6
push: true
tags: |
${{ env.TAGS }}
call_test:
needs:
- docker
- version
uses: ./.github/workflows/test.yml
with:
version: ${{ needs.version.outputs.version }}