diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index f376423b1..b3761e4ce 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -15,9 +15,14 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 2 + - name: Setup Node.js environment + uses: actions/setup-node@v3 + with: + node-version: 16 + cache: 'yarn' - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v19 + uses: tj-actions/changed-files@v33 with: files: | server/src/configs/default.json diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 6faf6bc72..2059b22dc 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,5 +1,5 @@ name: Docker -on: [push, release] +on: [push] env: REGISTRY: ghcr.io @@ -10,18 +10,26 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 2 - name: Setup Node.js environment - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: 16 - cache: "yarn" + cache: 'yarn' + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v33 + with: + files: | + server/src/configs/default.json - name: Generate latest env vars + if: steps.changed-files.outputs.any_changed == 'true' run: | yarn gen-env-config - name: Commit and push changes + if: steps.changed-files.outputs.any_changed == 'true' uses: devops-infra/action-commit-push@v0.9.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} @@ -31,33 +39,32 @@ jobs: needs: Sync runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - - name: Set .gitsha - if: github.event_name == 'push' - run: "echo ${{github.sha}} > .gitsha" - - name: Set .gitref - if: github.event_name == 'push' - run: "echo ${{github.ref}} > .gitref" + - uses: actions/checkout@v3 - - name: Log in to the Container registry - uses: docker/login-action@v1 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Set .gitsha + if: github.event_name == 'push' + run: 'echo ${{github.sha}} > .gitsha' + - name: Set .gitref + if: github.event_name == 'push' + run: 'echo ${{github.ref}} > .gitref' - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v3 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push Docker image - uses: docker/build-push-action@v2 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 758f5878c..dcf26c268 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,7 +12,7 @@ jobs: with: fetch-depth: 2 - name: Setup Node.js environment - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: 16 cache: 'yarn' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 207898138..1798a5d5b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ jobs: with: fetch-depth: 2 - name: Setup Node.js environment - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: 16 cache: 'yarn'