From b5cfea42f531f0f106bf1e42fedbf8bb40534a86 Mon Sep 17 00:00:00 2001 From: Gijsdeman Date: Wed, 30 Oct 2024 15:44:52 +0100 Subject: [PATCH] ci(build): add centralized workflow --- .github/workflows/build.yaml | 68 ++++++---------------------------- .github/workflows/release.yaml | 22 +---------- 2 files changed, 12 insertions(+), 78 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b59d3a8..186beac 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -17,60 +17,14 @@ permissions: statuses: read jobs: - lint-and-format: - runs-on: ubuntu-latest - container: - image: node:20 - steps: - - uses: actions/checkout@v4 - - name: Cache and restore node_modules - id: cache-node - uses: actions/cache@v4 - with: - path: ./node_modules - key: ${{ runner.os }}-node-${{ hashFiles('./yarn.lock') }} - - run: yarn - if: steps.cache-node.outputs.cache-hit != 'true' - - run: yarn lint - - run: yarn format - test: - needs: [ lint-and-format ] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Start Planka - run: docker compose -f "docker-compose.yml" up -d --build - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'yarn' - - run: yarn - - run: yarn test - - name: Stop Planka - if: always() - run: docker compose -f "docker-compose.yml" down - build: - needs: [ test ] - runs-on: ubuntu-latest - container: - image: node:20 - steps: - - uses: actions/checkout@v4 - - name: Cache and restore node_modules - id: cache-node - uses: actions/cache@v4 - with: - path: ./node_modules - key: ${{ runner.os }}-node-${{ hashFiles('./yarn.lock') }} - - run: yarn - if: steps.cache-node.outputs.cache-hit != 'true' - - run: yarn build - - name: "Compress out folder" - run: tar -zcvf dist.tar.gz dist/ - - name: "Upload /out of build" - uses: actions/upload-artifact@v4 - with: - name: build - path: dist.tar.gz - retention-days: 1 \ No newline at end of file + build-and-lint: + uses: GEWIS/actions/.github/workflows/typescript-lint-and-build.yml@v0.0.1 + with: + node-version: "20.x" + package-manager: "yarn" + prepare-command: "docker compose -f 'docker-compose.yml' up -d --build" + cleanup-command: "docker compose -f 'docker-compose.yml' down" + step-lint: true + step-format: true + step-test: true + step-build: true diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 25d911f..9308a51 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -11,24 +11,4 @@ concurrency: jobs: versioning: - runs-on: ubuntu-latest - - permissions: - contents: write - pull-requests: write - issues: write - - outputs: - next_version: ${{ steps.semantic.outputs.new_release_version }} - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - path: . - - - name: Semantic Release - uses: cycjimmy/semantic-release-action@v4 - id: semantic - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: GEWIS/actions/.github/workflows/versioning.yml@v0.0.1