diff --git a/.github/workflows/pockethost.yaml b/.github/workflows/pockethost.yaml deleted file mode 100644 index 0357c684..00000000 --- a/.github/workflows/pockethost.yaml +++ /dev/null @@ -1,19 +0,0 @@ -name: Node.js CI - -on: [push, pull_request] -jobs: - test: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [18.x] - - steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - run: yarn - - run: yarn lint diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 00000000..7ec4b699 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,48 @@ +on: [push] + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + deployments: write + name: Publish to Cloudflare Pages + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: 20.x + - run: yarn install + - run: yarn lint + - run: yarn build + + - name: Publish www to Cloudflare Pages + uses: cloudflare/pages-action@v1 + id: www_deploy + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + gitHubToken: ${{ secrets.GITHUB_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + projectName: pockethost + directory: ./packages/pockethost.io/build + branch: ${{ github.head_ref || github.ref_name }} + wranglerVersion: '3' + + - name: Discord feature branch notification + if: github.ref_name != 'master' + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + uses: Ilshidur/action-discord@master + with: + args: '**PREVIEW** ${{ steps.www_deploy.outputs.url }} was generated from [commit ${{ github.sha }}](https://github.com/${{ github.repository}}/commit/${{ github.sha }}) on [${{ github.repository}}#${{ github.ref_name }}](https://github.com/${{ github.repository}}/tree/${{ github.ref_name }})' + + - name: Discord live branch notification + if: github.ref_name == 'master' + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + uses: Ilshidur/action-discord@master + with: + args: '**LIVE** https://pockethost.io has been updated from [commit ${{ github.sha }}](https://github.com/${{ github.repository}}/commit/${{ github.sha }}) on [${{ github.repository}}#${{ github.ref_name }}](https://github.com/${{ github.repository}}/tree/${{ github.ref_name }})'