Repository navigation
docs: add bilingual (EN/ZH) versions of CONTRIBUTING, CHANGELOG, SECU… #1
Workflow file for this run
This file contains hidden or 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
| name: release | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| permissions: | |
| contents: write | |
| id-token: write | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4.4.0 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v5.6.0 | |
| with: | |
| python-version: "3.12" | |
| - uses: actions/setup-node@v4.4.0 | |
| with: | |
| node-version: "22" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Verify tag and package version | |
| id: package | |
| shell: bash | |
| run: | | |
| package_name="$(node -p 'require("./package.json").name')" | |
| package_version="$(node -p 'require("./package.json").version')" | |
| if [[ "${GITHUB_REF_NAME}" != "v${package_version}" ]]; then | |
| echo "Tag ${GITHUB_REF_NAME} does not match package version ${package_version}" >&2 | |
| exit 1 | |
| fi | |
| echo "name=${package_name}" >> "$GITHUB_OUTPUT" | |
| echo "version=${package_version}" >> "$GITHUB_OUTPUT" | |
| - name: Install validation dependencies | |
| run: python3 -m pip install pyyaml==6.0.3 | |
| - name: Validate release contents | |
| run: | | |
| python3 scripts/build-classic-hosts.py --check | |
| bash scripts/validate.sh | |
| bash scripts/smoke-install.sh | |
| bash scripts/smoke-npm.sh | |
| bash scripts/smoke-curl-install.sh | |
| bash scripts/scan-secrets.sh | |
| - name: Build GitHub Release assets | |
| run: bash scripts/build-release-archive.sh | |
| - name: Check whether npm version already exists | |
| id: npm | |
| shell: bash | |
| run: | | |
| if npm view "${{ steps.package.outputs.name }}@${{ steps.package.outputs.version }}" version >/dev/null 2>&1; then | |
| echo "published=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "published=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Publish npm package | |
| if: steps.npm.outputs.published != 'true' | |
| shell: bash | |
| run: | | |
| publish_tag="latest" | |
| if [[ "${{ steps.package.outputs.version }}" == *-* ]]; then | |
| publish_tag="next" | |
| fi | |
| npm publish --tag "$publish_tag" --provenance --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Create or update GitHub Release | |
| shell: bash | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| VERSION: ${{ steps.package.outputs.version }} | |
| run: | | |
| release_args=(--title "LoopForge v${VERSION}" --generate-notes) | |
| if [[ "$VERSION" == *-* ]]; then | |
| release_args+=(--prerelease) | |
| fi | |
| if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then | |
| gh release upload "$GITHUB_REF_NAME" \ | |
| dist/release/loopforge-workflow.tar.gz \ | |
| dist/release/loopforge-workflow.tar.gz.sha256 \ | |
| --clobber | |
| else | |
| gh release create "$GITHUB_REF_NAME" \ | |
| dist/release/loopforge-workflow.tar.gz \ | |
| dist/release/loopforge-workflow.tar.gz.sha256 \ | |
| "${release_args[@]}" | |
| fi |