Added workflows #4
Workflow file for this run
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: Publish CLI and create release | |
on: | |
push: | |
branches: | |
- cli/main | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: latest | |
- name: Install dependencies | |
run: npm install | |
- name: Apply changesets versioning | |
run: npx changeset version | |
- name: Get version from package.json | |
id: get_version | |
run: echo "version=$(jq -r .version package.json)" >> $GITHUB_ENV | |
- name: Create version commit | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add . | |
git commit -m "Version Packages" || echo "No changes to commit" | |
- name: Publish to npm | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npx changeset publish | |
- name: Push version commit and tags | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
run: | | |
git tag cli-${{ env.version }} | |
git push origin cli-${{ env.version }} --follow-tags | |
- name: Create GitHub release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
with: | |
tag_name: cli-${{ steps.get_version.outputs.version }} | |
release_name: "@ragejs/cli v${{ steps.get_version.outputs.version }}" | |
draft: false | |
prerelease: false | |
- name: Upload release asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./path/to/your/asset.zip # Adjust the path to your asset | |
asset_name: asset.zip # Adjust the asset name | |
asset_content_type: application/zip |