diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..681b332 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,48 @@ +name: Build & Deploy + +on: + push: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + + - run: npm ci + - run: npx astro build + + - uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ + + deploy: + name: Deploy to Cloudflare + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - name: Create wrangler.toml + run: | + echo 'name = "moonweb-28k8"' > wrangler.toml + echo 'compatibility_date = "2024-01-01"' >> wrangler.toml + echo '' >> wrangler.toml + echo '[assets]' >> wrangler.toml + echo 'directory = "./dist"' >> wrangler.toml + + - uses: cloudflare/wrangler-action@v4 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + command: deploy