Merge pull request #185 from PnEcrins/dependabot/pip/backend/coverage… #135
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 docker image | |
on: | |
release: | |
types: [created] | |
push: | |
branches: | |
- master | |
- main | |
- next | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write # required to publish docker image | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
CI: false | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Get frontend git cache key | |
run: | | |
echo "FRONT_CACHE_KEY=$(git log -n 1 --pretty=format:%h ./front-end)" >> $GITHUB_ENV | |
- name: Reconfigure git to use HTTP authentication | |
run: > | |
git config --global url."https://github.com/".insteadOf | |
ssh://git@github.com/ | |
- name: Cache front | |
id: cache-front | |
uses: actions/cache@v4 | |
with: | |
path: ./front-end/dist | |
key: front-${{ env.FRONT_CACHE_KEY }} | |
- name: Setup node for front | |
if: steps.cache-front.outputs.cache-hit != 'true' | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: './front-end/.nvmrc' | |
cache: 'npm' | |
cache-dependency-path: './front-end/package-lock.json' | |
- name: Install front dependencies | |
if: steps.cache-front.outputs.cache-hit != 'true' | |
working-directory: ./front-end | |
run: | | |
npm ci --no-audit | |
- name: Build front | |
if: steps.cache-front.outputs.cache-hit != 'true' | |
working-directory: ./front-end | |
run: | | |
cp .env.dist .env | |
npm run build | |
- uses: docker/setup-buildx-action@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker dev | |
id: meta-dev | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-dev | |
- name: Build and push Docker image dev | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: .docker/Dockerfile | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
push: true | |
tags: ${{ steps.meta-dev.outputs.tags }} | |
labels: ${{ steps.meta-dev.outputs.labels }} | |
target: dev | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: .docker/Dockerfile | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
target: prod | |
attach_install_release: | |
runs-on: ubuntu-latest | |
needs: [ release ] | |
permissions: | |
contents: write # required to attach zip to release | |
if: ${{ (github.event_name == 'release' && github.event.action == 'created') }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Prepare install.zip | |
run: | | |
cd install | |
mkdir -p rgalt/var rgalt/public | |
cp * ./rgalt 2>/dev/null || : | |
cp -r ./conf ./rgalt | |
zip -r ../install.zip rgalt/ | |
- name: Attach zip archive as release binary | |
uses: skx/github-action-publish-binaries@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
args: 'install.zip' |