chore: Try to make the build work #5 #7
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: Release dev | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
uses: ./.github/actions/npm-install | |
- name: Build assets | |
run: npm run build | |
- name: Determine tag name | |
id: tag_name | |
run: echo "::set-output name=TAG_NAME::v$(jq -r '.version' composer.json)" | |
- name: Create Git tag | |
run: git tag ${{ steps.tag_name.outputs.TAG_NAME }} -m "Release ${{ steps.tag_name.outputs.TAG_NAME }}" | |
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Use the GitHub token for authentication | |
- name: Push Git tag | |
run: git push origin ${{ steps.tag_name.outputs.TAG_NAME }} | |
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Use the GitHub token for authentication | |
- name: Create a release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ./* # Replace with the path to your plugin files | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Use the GitHub token for authentication | |
- name: Notify Packagist | |
env: | |
PACKAGIST_USERNAME: ${{ secrets.PACKAGIST_USERNAME }} | |
PACKAGIST_TOKEN: ${{ secrets.PACKAGIST_TOKEN }} | |
run: | | |
curl -X POST -H "Content-Type: application/json" -d '{ | |
"repository": "https://github.com/haariga/craft-gonzo", | |
"package": "haariga/craft-gonzo", | |
"version": "${{ steps.create_release.outputs.tag_name }}" | |
}' https://packagist.org/api/update-package?username=$PACKAGIST_USERNAME&apiToken=$PACKAGIST_TOKEN |