diff --git a/.github/actions/cache/action.yml b/.github/actions/cache/action.yml new file mode 100644 index 0000000..eeb9930 --- /dev/null +++ b/.github/actions/cache/action.yml @@ -0,0 +1,26 @@ +name: Yarn Cache +author: Maiko Tan +description: Cache Yarn dependencies + +inputs: + os: + description: | + The operating system to cache dependencies for. This should almost always be `runner.os`. + required: true + default: ${{ runner.os }} + +runs: + using: composite + steps: + - name: Get yarn cache directory path + id: yarn-cache-dir-path + shell: bash + run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT + + - uses: actions/cache@v3 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ inputs.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ inputs.os }}-yarn- diff --git a/.github/dependabot.yml b/.github/dependabot.yml index b417983..f71d469 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,4 +8,4 @@ updates: - package-ecosystem: "npm" # See documentation for possible values directory: "/" # Location of package manifests schedule: - interval: "daily" + interval: "monthly" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b0c838d..117328a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,23 @@ on: jobs: build: - uses: cordiverse/workflows/.github/workflows/build.yml@main - with: - lint: true - test: false + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + + - name: Enable Corepack + run: corepack enable + + - name: Cache Yarn dependencies + uses: ./.github/actions/cache + with: + os: ${{ runner.os }} + + - name: Install dependencies + run: yarn install + + - name: Lint JavaScript + run: yarn build + diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f3ce078..66bd534 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,6 +7,30 @@ on: jobs: publish: - uses: cordiverse/workflows/.github/workflows/publish.yml@main - secrets: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup Node + uses: actions/setup-node@v4 + + - name: Enable Corepack + run: corepack enable + + - name: Cache Yarn dependencies + uses: ./.github/actions/cache + with: + os: ${{ runner.os }} + + - name: Install + run: yarn + + - name: Build + run: yarn build + + - name: Set npm token + run: | + echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc + + - name: Publish packages + run: yarn pub