Skip to content

fix: Fix leftmenu. #159

fix: Fix leftmenu.

fix: Fix leftmenu. #159

name: test-and-release
on:
push:
branches:
- 2.x
- main
- alpha
- beta
- next
- next-major
jobs:
tests:
name: Run tests (Elixir ${{matrix.elixir}}, OTP ${{matrix.otp}})
strategy:
matrix:
include:
- elixir: 1.14
otp: 25
lint: lint
- elixir: 1.16
otp: 26
lint: lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Elixir
uses: erlef/setup-elixir@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Restore deps and _build cache
uses: actions/cache@v3
with:
path: |
deps
_build
key: deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}
- name: Install dependencies
run: mix deps.get --only test
env:
MIX_ENV: test
- name: Check source code format
run: mix format --check-formatted
if: ${{ matrix.lint }}
env:
MIX_ENV: test
- name: Remove compiled application files
run: mix clean
- name: Compile dependencies
run: mix compile
if: ${{ !matrix.lint }}
env:
MIX_ENV: test
- name: Compile & lint dependencies
run: mix compile --warnings-as-errors
if: ${{ matrix.lint }}
env:
MIX_ENV: test
- name: Run tests
run: mix test
env:
MIX_ENV: test
release:
name: semantic release
runs-on: ubuntu-latest
needs: [ tests ]
outputs:
version: ${{ steps.semantic.outputs.new_release_version }}
channel: ${{ steps.semantic.outputs.new_release_channel }}
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- name: ⬇️ Checkout repo
uses: actions/checkout@v3
- name: 💊 Setup Elixir
uses: erlef/setup-beam@v1
with:
otp-version: '26'
elixir-version: '1.16.3'
- name: ⎔ Setup node
uses: actions/setup-node@v3
with:
node-version: 18
- name: 🚀 Release
uses: cycjimmy/semantic-release-action@v3
id: semantic
with:
semantic_version: 19
extra_plugins: |
@semantic-release/changelog
@semantic-release/exec
@semantic-release/git
working_directory: apps/phoenix_duskmoon
env:
MIX_ENV: prod
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
build-demo:
name: Build demo
runs-on: ubuntu-latest
needs: [ release ]
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWD }}
-
name: Login to Github Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
platforms: linux/amd64
push: true
build-args: |
RELEASE_VERSION=${{ needs.release.outputs.version }}
tags: |
docker.io/gsmlg/duskmoon-storybook:v${{ needs.release.outputs.version }}
docker.io/gsmlg/duskmoon-storybook:${{ needs.release.outputs.channel || 'latest' }}
ghcr.io/gsmlg-dev/duskmoon-storybook:v${{ needs.release.outputs.version }}
ghcr.io/gsmlg-dev/duskmoon-storybook:${{ needs.release.outputs.channel || 'latest' }}