From 1aff3b23ab00e7498e50aaccb6ca26f5a5fb8717 Mon Sep 17 00:00:00 2001 From: Kohei Asai Date: Sat, 20 Mar 2021 10:40:53 -0700 Subject: [PATCH] feat(dx): Add release GitHub Action (#240) --- .github/workflows/release.yml | 71 +++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..dc932e18 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,71 @@ +name: Release +on: + push: + branches: + - master +jobs: + dry-build: + name: Dry Build + runs-on: ubuntu-latest + env: + NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA: ${{ github.sha }} + NEXT_PUBLIC_GRAPHCMS_ENDPOINT: ${{ secrets.E2E_GRAPHCMS_ENDPOINT }} + NEXT_PUBLIC_SIMPLE_LOCALIZE_TOKEN: ${{ secrets.E2E_SIMPLE_LOCALIZE_TOKEN }} + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: '14' + - name: Restore/cache npm packages + uses: actions/cache@v2 + env: + cache-name: cache-npm-packages + with: + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Install npm packages + run: npm ci + - name: Dry Build + run: npm run build + e2e-test: + name: E2E Test + runs-on: ubuntu-latest + env: + NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA: ${{ github.sha }} + NEXT_PUBLIC_GRAPHCMS_ENDPOINT: ${{ secrets.E2E_GRAPHCMS_ENDPOINT }} + NEXT_PUBLIC_SIMPLE_LOCALIZE_TOKEN: ${{ secrets.E2E_SIMPLE_LOCALIZE_TOKEN }} + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: '14' + - uses: microsoft/playwright-github-action@v1 + - name: Restore/cache npm packages + uses: actions/cache@v2 + env: + cache-name: cache-npm-packages + with: + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Install npm packages + run: npm ci + - name: Run E2E tests + run: npx start-server-and-test "npm run build && npx next start" "http://localhost:3000" "npm run e2e-test -- --ci --verbose" + release: + name: Release + runs-on: ubuntu-latest + needs: [dry-build, e2e-test] + steps: + - uses: actions/checkout@v2 + - name: Semantic Release + env: + GITHUB_TOKEN: ${{ github.token }} + run: npx --package semantic-release semantic-release