Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/release-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Release on Tag Push

on:
push:
tags:
- 'v*.*.*'

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: yarn

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Run tests (TODO)
run: |
echo "TODO: Add test execution step here"

- name: Create .env file
run: |
GIT_TAG=${GITHUB_REF#refs/tags/}
SHORT_SHA=$(git rev-parse --short HEAD)
echo "PORT=3000" >> .env
echo "JWT_SECRET=your_jwt_secret" >> .env
echo "JWT_ACCESS_EXPIRATION_MINUTES=30" >> .env
echo "JWT_REFRESH_EXPIRATION_DAYS=30" >> .env
echo "SMTP_HOST=email-server" >> .env
echo "SMTP_PORT=587" >> .env
echo "SMTP_USERNAME=email-server-username" >> .env
echo "SMTP_PASSWORD=email-server-password" >> .env
echo "EMAIL_FROM=support@yourapp.com" >> .env
echo "UPLOAD_PATH=./data/upload" >> .env
echo "MONGODB_URL=mongodb://127.0.0.1:27017/test-db" >> .env
echo "UPLOAD_PORT=4000" >> .env
echo "UPLOAD_DOMAIN=http://localhost" >> .env
echo "UPLOAD_PATH=./upload-data" >> .env
echo "TAG=dev-${SHORT_SHA}-${GIT_TAG}" >> .env

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Load TAG from .env
run: source .env && echo "TAG=$TAG" >> $GITHUB_ENV

- name: Build only services with build context
run: |
echo "🔧 Building with tag: $TAG"
docker compose --env-file .env -f docker-compose.yml -f docker-compose.dev.yml build playground-be upload

- name: Push images with dev-<sha>-<tag>
run: |
echo "🚀 Pushing images:"
echo " ghcr.io/${{ github.repository_owner }}/playground-be:$TAG"
echo " ghcr.io/${{ github.repository_owner }}/upload:$TAG"
docker push ghcr.io/${{ github.repository_owner }}/playground-be:$TAG
docker push ghcr.io/${{ github.repository_owner }}/upload:$TAG

- name: Create GitHub Release
continue-on-error: true
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 7 additions & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
services:
playground-be:
build:
context: .
image: ghcr.io/${GITHUB_REPOSITORY_OWNER}/playground-be:${TAG}
command: yarn dev -L
volumes:
- .:/usr/src/playground-be
Expand All @@ -8,11 +11,14 @@ services:
- .env

upload:
build:
context: .
image: ghcr.io/${GITHUB_REPOSITORY_OWNER}/upload:${TAG}
command: npm start
restart: no
env_file:
- .env

playground-db:
ports:
- "27017:27017"
Expand Down