fix: use node 16 for final build #9
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: CI | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
test-and-lint: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./api | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
pip install poetry | |
poetry install | |
- name: Run pytest | |
run: | | |
git config --global user.name "bil" | |
git config --global user.email "[email protected]" | |
poetry run pytest | |
- name: Run flake8 | |
run: poetry run flake8 | |
semver-action: | |
needs: test-and-lint | |
outputs: | |
tag: ${{ steps.semver-action.outputs.tag }} | |
version: ${{ steps.semver-action.outputs.version }} | |
release_notes: ${{ steps.semver-action.outputs.release_notes }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Semver Action | |
id: semver-action | |
run: python .github/scripts/semver.py | |
build-and-release: | |
needs: semver-action | |
runs-on: ubuntu-latest | |
if: needs.semver-action.outputs.version != '' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Update pyproject.toml version | |
run: | | |
cd api | |
pip install poetry | |
poetry version ${{ needs.semver-action.outputs.version }} | |
cd .. | |
- name: Commit version changes | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add api/pyproject.toml | |
git commit -m "chore: bump version to ${{ needs.semver-action.outputs.tag }}" | |
git tag ${{ needs.semver-action.outputs.tag }} | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
tags: true | |
- name: Create Release | |
id: create-release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ needs.semver-action.outputs.tag }} | |
body: ${{ needs.semver-action.outputs.release_notes }} | |
build-and-push: | |
needs: | |
- build-and-release | |
- semver-action | |
if: needs.semver-action.outputs.version != '' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Set up Node.js 16 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '16' | |
- name: Build API and UI | |
run: | | |
cd api | |
pip install poetry | |
poetry export --format=requirements.txt --output=requirements.txt --without-hashes --without dev | |
cd .. | |
cd bil-ui | |
yarn | |
yarn build | |
cd .. | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: builder555 | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Build and push multi-platform Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: builder555/bil:latest | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 |