diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index edb3238..56e329c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -6,12 +6,22 @@ on: - .gitignore - docker/** - "**/*.md" + branches-ignore: + - main pull_request: paths-ignore: - .gitignore - docker/** - "**/*.md" workflow_dispatch: + workflow_call: + outputs: + openmenu-artifact-id: + description: ID of the uploaded openmenu artifact + value: ${{ jobs.openmenu.outputs.openmenu-artifact-id }} + tools-artifact-id: + description: ID of the uploaded tools artifact + value: ${{ jobs.openmenu.outputs.tools-artifact-id }} permissions: contents: read @@ -22,6 +32,9 @@ concurrency: jobs: openmenu: + outputs: + openmenu-artifact-id: ${{ steps.openmenu-artifact.outputs.artifact-id }} + tools-artifact-id: ${{ steps.tools-artifact.outputs.artifact-id }} runs-on: ubuntu-latest container: image: sbstnc/openmenu-dev:0.2.2 @@ -47,6 +60,7 @@ jobs: - name: Upload openmenu artifacts uses: actions/upload-artifact@v4 + id: openmenu-artifact with: name: openmenu path: | @@ -55,6 +69,7 @@ jobs: - name: Upload tool artifacts uses: actions/upload-artifact@v4 + id: tools-artifact with: name: tools path: | diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml new file mode 100644 index 0000000..f3e44a5 --- /dev/null +++ b/.github/workflows/release-please.yaml @@ -0,0 +1,65 @@ +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + issues: write + +name: release-please + +jobs: + release-please: + outputs: + release_created: ${{ steps.release.outputs.release_created }} + tag_name: ${{ steps.release.outputs.tag_name }} + runs-on: ubuntu-latest + steps: + - name: Release Please + uses: googleapis/release-please-action@v4 + id: release + + - name: Check out source code + if: ${{ steps.release.outputs.release_created }} + uses: actions/checkout@v4 + + - name: Tag major and minor versions + if: ${{ steps.release.outputs.release_created }} + run: | + git config user.name github-actions[bot] + git config user.email github-actions[bot]@users.noreply.github.com + git tag -d v${{ steps.release.outputs.major }} || true + git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true + git push origin :v${{ steps.release.outputs.major }} || true + git push origin :v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true + git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }}" + git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}" + git push origin v${{ steps.release.outputs.major }} + git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} + + call-ci: + needs: [ release-please ] + if: ${{ needs.release-please.outputs.release_created }} + uses: ./.github/workflows/ci.yaml + + attach-artifacts: + needs: [ release-please, call-ci ] + if: ${{ needs.release-please.outputs.release_created }} + runs-on: ubuntu-latest + steps: + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + artifact-ids: ${{ needs.call-ci.outputs.openmenu-artifact-id }},${{ needs.call-ci.outputs.tools-artifact-id }} + path: ./artifacts + + - name: Upload release artifacts + run: | + zip -r -j ./artifacts/openmenu.zip ./artifacts/openmenu/ + zip -r -j ./artifacts/tools-linux-x64.zip ./artifacts/tools/ + gh release upload ${{ needs.release-please.outputs.tag_name }} \ + ./artifacts/openmenu.zip \ + ./artifacts/tools-linux-x64.zip \ + --clobber diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..fea3454 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.0.0" +} \ No newline at end of file diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..49d62c9 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,12 @@ +{ + "release-type": "simple", + "include-component-in-tag": false, + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, + "plugins": ["sentence-case"], + "packages": { + ".": { + "package-name": "openmenu" + } + } +} \ No newline at end of file diff --git a/version.txt b/version.txt new file mode 100644 index 0000000..afaf360 --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +1.0.0 \ No newline at end of file