This file contains hidden or 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: Deploy to GitHub Container Registry | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4.0.0 | |
| with: | |
| package_json_file: 'frontend/package.json' | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: 'frontend/.nvmrc' | |
| registry-url: https://npm.pkg.github.com/ | |
| cache: pnpm | |
| cache-dependency-path: frontend/pnpm-lock.yaml | |
| - name : Install dependencies | |
| run: make reqs-ci | |
| - name: Check formatting | |
| run: make check-format-ci | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.PAT }} | |
| - name: Get version | |
| id: get_version | |
| run: | | |
| VERSION=$(uv version --short) | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Build frontend | |
| run: | | |
| make build-frontend-ci | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| tags: | | |
| ghcr.io/${{ github.repository_owner }}/cdmserver:${{ steps.get_version.outputs.VERSION }} | |
| ghcr.io/${{ github.repository_owner }}/cdmserver:latest | |
| - name: Log out from GitHub Container Registry | |
| run: docker logout ghcr.io | |
| - name: Create and push git tag | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --global user.name "github-actions[bot]" | |
| git tag ${{ steps.get_version.outputs.VERSION }} | |
| git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git ${{ steps.get_version.outputs.VERSION }} |