fix: use next as default bundle on push #2
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: Release | |
on: | |
push: | |
branches: | |
- master | |
- feature/* | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: "Branch to release from" | |
required: true | |
default: "feature/debian-and-upgrades-melle" | |
bundle: | |
description: "Bundle ID (next, self)" | |
required: true | |
default: "next" | |
jobs: | |
build-release: | |
runs-on: ubuntu-20.04 | |
env: | |
MIX_ENV: prod | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.branch || github.ref }} | |
- name: Set TAG and VERSION | |
id: vars | |
run: | | |
TAG="${{ inputs.bundle }}_$(date +%F)_${{ github.run_number }}" | |
echo "TAG=$TAG" >> $GITHUB_ENV | |
echo "VERSION=$TAG" >> $GITHUB_ENV | |
shell: bash | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build Docker Image (dev target) with cache | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
target: dev | |
tags: next-platform:latest | |
push: false | |
load: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Run build inside Docker | |
run: | | |
docker run --rm \ | |
-e MIX_ENV=$MIX_ENV \ | |
-e BUNDLE=${{ inputs.bundle || 'next' }} \ | |
-e VERSION=$VERSION \ | |
-v ${{ github.workspace }}:/app \ | |
next-platform:latest \ | |
bash -c "cd /app/core && ./scripts/build-frontend && ./scripts/build-release" | |
- name: Archive release | |
run: tar cfj "../${{env.VERSION}}.tar.bz2" "${{env.VERSION}}" | |
working-directory: core | |
- uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: "${{env.VERSION}}" | |
prerelease: false | |
fail_on_unmatched_files: true | |
files: | | |
${{env.VERSION}}.tar.bz2 |