Merge pull request #15 from Emiliopg91/develop #43
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 | |
permissions: | |
contents: write | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build_plugin: | |
runs-on: ubuntu-latest | |
container: | |
image: archlinux:latest | |
steps: | |
- name: set git global safe directory | |
run: | | |
pacman -Syu git npm jq --noconfirm | |
git config --global --add safe.directory $(realpath .) | |
- uses: actions/checkout@v3 | |
- name: Get version from package.json | |
id: get_version | |
run: | | |
VERSION=$(jq -r '.version' package.json | sed 's/-.*//') | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
echo "Package version: $VERSION" | |
- name: build plugin | |
run: | | |
npm i -g [email protected] | |
pnpm install --no-frozen-lockfile | |
pnpm run build | |
tar -czvf AllyDeckyCompanion.tar.gz --transform 's,^,AllyDeckyCompanion/,' dist py_modules bin ota_update.sh *.py *.json *.md *.js LICENSE | |
continue-on-error: true | |
- name: show files | |
run: | | |
tar -tzvf AllyDeckyCompanion.tar.gz | |
- name: Publish Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: AllyDeckyCompanion | |
path: AllyDeckyCompanion.tar.gz | |
- name: Bump version to next DEV version | |
run: | | |
npm version --no-commit-hooks --no-git-tag-version prepatch --preid dev | |
jq '.version |= sub("-dev\\.0$"; "-dev")' package.json > package.tmp.json | |
mv package.tmp.json package.json | |
- name: Commit and push changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add package.json | |
git commit -m "Bump version to prepatch" | |
git push origin HEAD:main | |
- name: Create and push tag | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git tag -a "v${{ env.VERSION }}" -m "Release version ${{ env.VERSION }}" | |
git push origin "v${{ env.VERSION }}" | |
- name: Checkout develop branch | |
run: | | |
git fetch origin | |
git checkout develop | |
git pull origin develop | |
- name: Merge main into develop | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git merge -X theirs main | |
git push origin HEAD:develop --force | |
publish: | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: [build_plugin] | |
steps: | |
- run: mkdir /tmp/artifacts | |
- name: download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
path: /tmp/artifacts | |
- run: ls -R /tmp/artifacts | |
- name: publish to github release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: /tmp/artifacts/AllyDeckyCompanion/AllyDeckyCompanion.tar.gz | |
tag_name: ${{ env.VERSION }} | |
name: ${{ env.VERSION }} | |
body: | | |
AllyDeckyCompanion | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |