diff --git a/.github/workflows/deployment-lunaria.yaml b/.github/workflows/deployment-lunaria.yaml index c734828..859e2a7 100644 --- a/.github/workflows/deployment-lunaria.yaml +++ b/.github/workflows/deployment-lunaria.yaml @@ -1,91 +1,83 @@ name: Deployment Lunaria on: - push: - branches: [main] - merge_group: - pull_request: - branches: [main] - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: + push: + branches: [main] + merge_group: + pull_request: + branches: [main] + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: # Automatically cancel in-progress actions on the same branch concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }} + cancel-in-progress: true env: - REGISTRY: docker.io - IMAGE_NAME: trueberryless/i18n-mutanuq - NODE_VERSION: 20 + REGISTRY: docker.io + IMAGE_NAME: trueberryless/i18n-mutanuq + NODE_VERSION: 20 jobs: - deployment: - if: contains(github.event.head_commit.message, 'deploy') || github.event_name == 'workflow_dispatch' - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - name: Check out the repo - uses: actions/checkout@v4 - with: - fetch-depth: 0 + deployment: + if: contains(github.event.head_commit.message, 'deploy') || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Check out the repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 - - name: Create tag - run: echo "IMAGE_TAG=$(echo $GITHUB_REF_NAME-$GITHUB_SHA)" >> $GITHUB_ENV + - name: Create tag + run: echo "IMAGE_TAG=$(echo $GITHUB_REF_NAME-$GITHUB_SHA)" >> $GITHUB_ENV - - name: Setup PNPM - uses: pnpm/action-setup@v3 - with: - package_json_file: ./starlight/package.json + - name: Setup PNPM + uses: pnpm/action-setup@v3 + with: + package_json_file: ./starlight/package.json - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: pnpm - cache-dependency-path: ./starlight/pnpm-lock.yaml + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm + cache-dependency-path: ./starlight/pnpm-lock.yaml - - name: Install dependencies - run: pnpm install - shell: bash - working-directory: ./starlight + - name: Install dependencies + run: pnpm install + shell: bash + working-directory: ./starlight - - name: Build Lunaria Website - run: pnpm run lunaria:build - shell: bash - working-directory: ./starlight + - name: Build Lunaria Website + run: pnpm run lunaria:build + shell: bash + working-directory: ./starlight - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - name: Build and push Docker image - uses: docker/build-push-action@v6 - with: - context: . - file: ./starlight/lunaria/Dockerfile - push: true - tags: | - ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} - ${{ env.IMAGE_NAME }}:latest - labels: ${{ steps.meta.outputs.labels }} - - - name: Update manifest-lunaria/deployment.yaml file - run: | - yq eval '.spec.template.spec.containers[0].image = "${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}"' -i manifest-lunaria/deployment.yaml - - - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: update manifest-lunaria/deployment.json container image (automated) + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: ./starlight/lunaria/Dockerfile + push: true + tags: | + ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} + ${{ env.IMAGE_NAME }}:latest + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/deployment.yaml b/.github/workflows/deployment.yaml index 460bd13..421fecf 100644 --- a/.github/workflows/deployment.yaml +++ b/.github/workflows/deployment.yaml @@ -149,14 +149,6 @@ jobs: ${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:latest labels: ${{ steps.meta.outputs.labels }} - - name: Update deployment.yaml file - run: | - yq eval '.spec.template.spec.containers[0].image = "${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ needs.image-tag.outputs.IMAGE_TAG }}"' -i manifest/deployment.yaml - - - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: update deployment.json container image (automated) - release: name: Release needs: [image-tag, deployment]