Changed delimiters #29
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
name: Create release | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
create-release: | |
name: Create release | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create-release.outputs.upload_url }} | |
version: ${{ steps.get-version.outputs.version }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
- name: Read version from package.json | |
id: get-version | |
run: | | |
VERSION=$(node -p "require('./package.json').version") | |
echo "version=$VERSION" >> $GITHUB_ENV | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Create Git tag | |
run: | | |
git tag v${{ env.version }} | |
git push origin v${{ env.version }} | |
- name: Create GitHub release | |
id: create-release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: "v${{ env.version }}" | |
release_name: "${{ env.version }}" | |
body: "Release for version ${{ env.version }}" | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
upload-assets: | |
name: Upload asset | |
needs: create-release | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
- name: Install dependencies | |
run: npm --color install | |
- name: Package artifact | |
run: npm --color run package | |
- name: Compress artifact (Windows) | |
run: powershell.exe Compress-Archive -Path 'dist/*' -DestinationPath 'artifact.zip' | |
if: runner.os == 'Windows' | |
- name: Compress artifact (Linux) | |
run: zip -r artifact.zip dist/* | |
if: runner.os != 'Windows' | |
- name: Upload release asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create-release.outputs.upload_url }} | |
asset_path: ./artifact.zip | |
asset_name: Clippy-${{ needs.create-release.outputs.version }}-${{ runner.os }}.zip | |
asset_content_type: application/zip |