1name: Publish Artifacts
2on:
3  push:
4    branches: [main]
5    tags-ignore: [dev]
6
7permissions:
8  contents: write
9  id-token: write
10  attestations: write
11
12jobs:
13  publish:
14    name: Publish artifacts of build
15    runs-on: ubuntu-latest
16    if: github.repository == 'bytecodealliance/wasmtime'
17    steps:
18    - uses: actions/checkout@v4
19    - uses: ./.github/actions/fetch-run-id
20    - run: |
21        gh run download ${COMMIT_RUN_ID}
22        ls
23        find bins-*
24      env:
25        GH_TOKEN: ${{ github.token }}
26
27    - run: ./ci/merge-artifacts.sh
28
29    # Deploy the `gh-pages.tar.gz` artifact to the `gh-pages` branch.
30    - run: tar xf gh-pages.tar.gz
31      working-directory: gh-pages
32    - if: github.ref == 'refs/heads/main'
33      uses: actions/configure-pages@v5
34    - if: github.ref == 'refs/heads/main'
35      uses: actions/upload-pages-artifact@v3
36      with:
37        path: "./gh-pages/gh-pages"
38
39    - uses: actions/attest-build-provenance@v1
40      with:
41        subject-path: 'dist/*'
42
43    - run: npm install --production
44      working-directory: .github/actions/github-release
45    - name: Publish Release
46      uses: ./.github/actions/github-release
47      with:
48        files: "dist/*"
49        token: ${{ github.token }}
50      continue-on-error: true
51
52  # See https://github.com/actions/deploy-pages
53  deploy:
54    name: Deploy gh-pages artifact
55    if: github.ref == 'refs/heads/main'
56    needs: publish
57    permissions:
58      pages: write
59      id-token: write
60    runs-on: ubuntu-latest
61    environment:
62      name: github-pages
63      url: ${{ steps.deployment.outputs.page_url }}
64    steps:
65      - id: deployment
66        uses: actions/deploy-pages@v4
67