chore(release): 🔖 1.13.0 #111
Workflow file for this run
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: "Build and Push for Production" | |
on: | |
push: | |
tags: | |
- "v*" | |
paths: | |
# - ".github/workflows/build-and-push.yaml" | |
- "src/**" | |
- "public/**" | |
- ".env.production" | |
jobs: | |
build-pages: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{github.event.after}} | |
repository: ${{github.repository}} | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- uses: pnpm/action-setup@v3 | |
name: Install pnpm | |
with: | |
version: 9 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install packages | |
run: pnpm install | |
- name: Build pages | |
run: | | |
pnpm build | |
env: | |
NODE_OPTIONS: --max_old_space_size=4096 | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pages | |
path: | | |
build/ | |
nginx/ | |
Dockerfile.cloud | |
build-docker: | |
runs-on: ubuntu-latest | |
needs: build-pages | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: pages | |
- name: Rename Dockerfile | |
run: mv Dockerfile.cloud Dockerfile | |
- name: Setup buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Dokcer meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ secrets.DOCKER_DOMAIN }}/sekai-viewer | |
tags: | | |
type=semver,pattern={{version}} | |
- name: Login to registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ secrets.DOCKER_DOMAIN }} | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
env: | |
DOCKER_BUILDKIT: 1 | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{github.event.after}} | |
repository: ${{github.repository}} | |
path: repo | |
- name: Update deployment.yaml, commit and push | |
working-directory: ./repo | |
run: | | |
sed -i "s/${{ secrets.DOCKER_DOMAIN }}\/sekai-viewer:.*$/${{ secrets.DOCKER_DOMAIN }}\/sekai-viewer:${{ steps.meta.outputs.version }}/g" manifests/deployment.yaml | |
git config --global user.email "actions@github.com" | |
git config --global user.name "GitHub Actions" | |
git add manifests/deployment.yaml | |
git commit -m "Update deployment.yaml to version ${{ steps.meta.outputs.version }}" | |
git push origin HEAD:deploy -f |