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@v6
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    - if: github.ref_name == 'main'
44      run: |
45          git tag -f dev
46          git push origin dev:dev -f
47          gh release create dev --prerelease dist/* ||
48            gh release upload dev --clobber dist/*
49      env:
50        GH_TOKEN: ${{ github.token }}
51
52    - if: github.ref_name != 'main'
53      run: |
54        sed '/---------------/Q' RELEASES.md > relnotes.md
55        gh release create ${{ github.ref_name }} --notes-file relnotes.md dist/*
56      env:
57        GH_TOKEN: ${{ github.token }}
58      continue-on-error: true
59
60  # See https://github.com/actions/deploy-pages
61  deploy:
62    name: Deploy gh-pages artifact
63    if: github.ref == 'refs/heads/main'
64    needs: publish
65    permissions:
66      pages: write
67      id-token: write
68    runs-on: ubuntu-latest
69    environment:
70      name: github-pages
71      url: ${{ steps.deployment.outputs.page_url }}
72    steps:
73      - id: deployment
74        uses: actions/deploy-pages@v4
75