diff --git a/.github/workflows/publish-crate.yml b/.github/workflows/publish-crate.yml new file mode 100644 index 0000000000..5d8aa2289e --- /dev/null +++ b/.github/workflows/publish-crate.yml @@ -0,0 +1,30 @@ +name: Publish to crates.io +on: + push: + tags: ['v*'] # Triggers when pushing tags starting with 'v' +jobs: + publish: + if: github.repository == 'ruby/prism' + runs-on: ubuntu-latest + environment: release # Optional: for enhanced security + permissions: + id-token: write # Required for OIDC token exchange + steps: + - name: Harden Runner + uses: step-security/harden-runner@v2 + with: + egress-policy: audit + - uses: actions/checkout@v5 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - uses: rust-lang/crates-io-auth-action@v1 + id: auth + + - run: bundle exec rake cargo:publish:real + env: + CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} diff --git a/.github/workflows/publish-gem.yml b/.github/workflows/publish-gem.yml new file mode 100644 index 0000000000..c64a65b66a --- /dev/null +++ b/.github/workflows/publish-gem.yml @@ -0,0 +1,39 @@ +name: Publish gem to rubygems.org + +on: + push: + tags: + - 'v*' + +permissions: + contents: read + +jobs: + push: + if: github.repository == 'ruby/prism' + runs-on: ubuntu-latest + + environment: + name: rubygems.org + url: https://rubygems.org/gems/prism + + permissions: + contents: write + id-token: write + + steps: + - name: Harden Runner + uses: step-security/harden-runner@v2 + with: + egress-policy: audit + + - uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Publish to RubyGems + uses: rubygems/release-gem@v1 diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml new file mode 100644 index 0000000000..9e498684ef --- /dev/null +++ b/.github/workflows/publish-npm.yml @@ -0,0 +1,45 @@ +name: Publish to npmjs.com +on: + push: + tags: ['v*'] # Triggers when pushing tags starting with 'v' +jobs: + publish: + if: github.repository == 'ruby/prism' + runs-on: ubuntu-latest + environment: release # Optional: for enhanced security + permissions: + id-token: write # Required for OIDC token exchange + steps: + - name: Harden Runner + uses: step-security/harden-runner@v2 + with: + egress-policy: audit + - uses: actions/checkout@v5 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Set up node + uses: actions/setup-node@v4 + with: + node-version: '20' + registry-url: 'https://registry.npmjs.org' + + - name: rake templates + run: bundle exec rake templates + + - name: Set up WASI-SDK + run: | + wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz + tar xvf wasi-sdk-25.0-x86_64-linux.tar.gz + + - name: Build the project + run: make wasm WASI_SDK_PATH=$(pwd)/wasi-sdk-25.0-x86_64-linux + + - name: Update npm + run: npm install -g npm@latest + + - run: npm publish