Skip to content

Commit

Permalink
feat: CI is configured to build and publish releases in Docker Hub
Browse files Browse the repository at this point in the history
  • Loading branch information
antonko committed Mar 30, 2024
1 parent 01956d2 commit e689747
Show file tree
Hide file tree
Showing 4 changed files with 11,033 additions and 33 deletions.
64 changes: 34 additions & 30 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Code Check on Push
name: Code Check on Release

on:
push:
Expand Down Expand Up @@ -48,8 +48,8 @@ jobs:
working-directory: ./backend
run: pdm run ruff .

frontend-build:
needs: frontend-check
build:
needs: [frontend-check, backend-check]
runs-on: ubuntu-latest

steps:
Expand All @@ -74,33 +74,23 @@ jobs:
- name: Run build
run: yarn run build
working-directory: ./frontend

- name: Copy build files to backend
run: cp -r ./frontend/dist/* ./backend/src/static/

- name: Archive backend files
run: |
cd ./backend
zip -r ../build.zip ./*
docker-build:
needs: [frontend-build, backend-check]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# - name: Login to DockerHub
# uses: docker/login-action@v1
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
- name: Upload build archive as artifact
uses: actions/upload-artifact@v4
with:
context: .
file: ./Dockerfile
push: false
name: build-archive
path: ./build.zip

semantic-release:
needs: [docker-build]
release:
needs: [build]
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -109,13 +99,27 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Build Docker image
run: docker build -t antonk0/arq-ui-test:latest .

- name: Setup Node.js
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: build-archive
path: ./

- name: Install semantic release
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Semantic Release
run: npx semantic-release
- name: Install dependencies
run: npm ci

- name: Release
run: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
26 changes: 23 additions & 3 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
{
"branches": ["main"],
"branches": [
"main"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator"
"@semantic-release/release-notes-generator",
[
"@semantic-release/github",
{
"assets": [
{
"path": "build.zip",
"label": "Built Files"
}
],
"releasedLabels": "released"
}
],
[
"@semantic-release-plus/docker",
{
"name": "antonk0/arq-ui-test"
}
]
]
}
}
Loading

0 comments on commit e689747

Please sign in to comment.