Add back in resources destructors to Rust exports (#888) #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Publication half of the release process for this repository. This runs on | |
# pushes to `main` and will detect a magical string in commit messages. When | |
# found a tag will be created, pushed, and then everything is published. | |
name: Publish Artifacts | |
on: | |
push: | |
branches: [main] | |
permissions: | |
contents: write | |
jobs: | |
create_tag: | |
name: Publish artifacts of build | |
runs-on: ubuntu-latest | |
if: | | |
github.repository_owner == 'bytecodealliance' | |
&& github.event_name == 'push' | |
&& github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- run: rustup update stable && rustup default stable | |
# If this is a push to `main` see if the push has an indicator saying that | |
# a tag should be made. If so create one and push it. | |
- name: Test if tag is needed | |
run: | | |
git log ${{ github.event.before }}...${{ github.event.after }} | tee main.log | |
version=$(./ci/print-current-version.sh) | |
echo "version: $version" | |
echo "version=$version" >> $GITHUB_OUTPUT | |
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
if grep -q "automatically-tag-and-release-this-commit" main.log; then | |
echo push-tag | |
echo "push_tag=yes" >> $GITHUB_OUTPUT | |
else | |
echo no-push-tag | |
echo "push_tag=no" >> $GITHUB_OUTPUT | |
fi | |
id: tag | |
- name: Push the tag | |
run: | | |
git_refs_url=$(jq .repository.git_refs_url $GITHUB_EVENT_PATH | tr -d '"' | sed 's/{\/sha}//g') | |
curl -iX POST $git_refs_url \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-d @- << EOF | |
{ | |
"ref": "refs/tags/v${{ steps.tag.outputs.version }}", | |
"sha": "${{ steps.tag.outputs.sha }}" | |
} | |
EOF | |
if: steps.tag.outputs.push_tag == 'yes' | |
- run: | | |
sha=${{ github.sha }} | |
run_id=$( | |
gh api -H 'Accept: application/vnd.github+json' \ | |
/repos/${{ github.repository }}/actions/workflows/main.yml/runs\?exclude_pull_requests=true \ | |
| jq '.workflow_runs' \ | |
| jq "map(select(.head_commit.id == \"$sha\"))[0].id" \ | |
) | |
gh run download $run_id | |
ls | |
find bins-* | |
mkdir dist | |
mv bins-*/* dist | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- uses: softprops/action-gh-release@v1 | |
if: steps.tag.outputs.push_tag == 'yes' | |
with: | |
files: "dist/*" | |
tag_name: v${{ steps.tag.outputs.version }} | |
- run: | | |
rm -rf dist main.log | |
rustc ci/publish.rs | |
./publish publish | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
if: steps.tag.outputs.push_tag == 'yes' |