Skip to content

Commit

Permalink
feat(ci): first draft of release uploading
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamalam360 committed Mar 26, 2024
1 parent 5b70d24 commit ad5ebbc
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 1 deletion.
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
permissions:
# Allows creation of releases
contents: write
outputs:
release_upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
Expand All @@ -29,11 +31,13 @@ jobs:
- name: Package VSCode Extension
working-directory: vscode
run: npm run package

- name: Publish to VSCode Marketplace
working-directory: vscode
run: npm run publish:vsce
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}

- name: Publish to OpenVSX
working-directory: vscode
run: npm run publish:ovsx
Expand All @@ -55,6 +59,7 @@ jobs:
echo "COMMITS<<$EOF" >> $GITHUB_OUTPUT
echo "COMMITS=\"$(awk -v latest="$(grep -Eo '^## v[0-9]+\.[0-9]+\.[0-9]+$' CHANGELOG.md | head -n1)" '/^## v/ {if (header) exit; header=1} /^## v'${latest}'/{print; next} header && !/^## v/{print}' CHANGELOG.md)\"" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand All @@ -74,10 +79,63 @@ jobs:
${{ steps.get_changelog.outputs.COMMITS }}
draft: true
prerelease: false

- uses: xresloader/upload-to-github-release@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "vscode/pest.vsix;sublime-text/pest.sublime-package"
release_id: ${{ steps.create_release.outputs.id }}
overwrite: true

build-binaries:
needs: release
runs-on: ubuntu-latest

permissions:
# So we can upload to the release
contents: write

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
arch: [x86_64]

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup
uses: ./.github/actions/setup
with:
kind: release-compile-binaries
secret: ${{ secrets.GITHUB_TOKEN }}

- name: Build binary
run: cargo build --release --target=$TARGET

- name: Package binary
run: tar -czvf pest-lsp-${{ matrix.os }}-${{ matrix.arch }}.tar.gz -C target/$TARGET/release/*

- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.release.tag_name }}
release_name: ${{ github.event.release.tag_name }}
body: |
Release ${{ github.event.release.tag_name }}
draft: false
prerelease: false

- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ jobs.release.outputs.release_upload_url }}
asset_path: ./pest-language-server-${{ matrix.os }}-${{ matrix.arch }}.tar.gz
asset_name: pest-language-server-${{ matrix.os }}-${{ matrix.arch }}.tar.gz
asset_content_type: application/gzip
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ad5ebbc

Please sign in to comment.