From f574f24b291eaa25ce31585a800c0a8aeea7e610 Mon Sep 17 00:00:00 2001 From: Yuzu Date: Thu, 6 Apr 2023 19:26:36 +0700 Subject: [PATCH] Updated workflows --- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/docker-build.yml | 16 +++++++++ .github/workflows/docker-image.yml | 18 ---------- .github/workflows/docker-publish.yaml | 47 +++++++++++++++++++++++++++ 4 files changed, 64 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/docker-build.yml delete mode 100644 .github/workflows/docker-image.yml create mode 100644 .github/workflows/docker-publish.yaml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 74155e6..50ea041 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,7 +32,7 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'javascript' ] + language: [ 'typescript' ] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..994f2ac --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,16 @@ +name: Docker Build + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Build Docker image + id: build-image + uses: docker/build-push-action@v2 + with: + push: false diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index 8a2b825..0000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Docker Image CI - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Build the Docker image - run: docker build . --file Dockerfile --tag ghcr.io/kirameki-cafe/yumi:$(date +%s) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml new file mode 100644 index 0000000..e537487 --- /dev/null +++ b/.github/workflows/docker-publish.yaml @@ -0,0 +1,47 @@ +name: Docker Build and Publish + +on: + push: + branches: + - main + tags: + - '*' + +env: + IMAGE_NAME: ghcr.io/kirameki-cafe/yumi + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ secrets.GHCR_IO_USERNAME }} + password: ${{ secrets.GHCR_IO_TOKEN }} + + - name: Docker meta + id: docker-meta + uses: docker/metadata-action@v3 + with: + images: | + ${{ env.IMAGE_NAME }} + tags: | + type=raw,value=latest,enable=${{ github.ref_type == 'tag' && !contains(github.ref_name, '-') }} + type=raw,value=latest-dev,enable=${{ github.ref_type == 'branch' }} + type=raw,value=${{ github.ref_name }} + type=raw,value=${{ github.sha }},enable=${{ github.ref_type == 'branch' }} + flavor: | + latest=false + + - name: Docker Build and Push + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ steps.docker-meta.outputs.tags }} + labels: ${{ steps.docker-meta.outputs.labels }}