diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..eb6b1ef --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,68 @@ +name: release-please + +on: + push: + branches: + - base + +permissions: + contents: write + pull-requests: write + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: google-github-actions/release-please-action@v4 + id: release + with: + release-type: node + + # Handle the PR artifacts while the PR is open/updated + # The output 'pr' is only present if a release PR was created or updated. + - name: Checkout PR branch + if: ${{ steps.release.outputs.pr }} + uses: actions/checkout@v4 + with: + # Use headBranchName from the PR object + ref: ${{ fromJson(steps.release.outputs.pr).headBranchName }} + + - name: Setup Node + if: ${{ steps.release.outputs.pr }} + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + + - name: Cache node_modules + if: ${{ steps.release.outputs.pr }} + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Install dependencies + if: ${{ steps.release.outputs.pr }} + run: npm ci + + - name: Update version in Settings.vue + if: ${{ steps.release.outputs.pr }} + run: | + NEW_VERSION="v${{ fromJson(steps.release.outputs.pr).version }}" + # Use sed to replace the version line. Escaping single quotes for the sed command. + sed -i "s/const VERSION = '.*';/const VERSION = '$NEW_VERSION';/" resources/js/pages/Settings.vue + + - name: Generate production artifacts + if: ${{ steps.release.outputs.pr }} + run: npm run build + + - name: Commit and push changes + if: ${{ steps.release.outputs.pr }} + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "build: update production artifacts for ${{ fromJson(steps.release.outputs.pr).version }}" + file_pattern: "resources/dist/* resources/js/pages/Settings.vue" + # Ensure we push to the correct branch + branch: ${{ fromJson(steps.release.outputs.pr).headBranchName }} diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml deleted file mode 100644 index f5fac7c..0000000 --- a/.github/workflows/update-changelog.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: 'update-changelog' - -on: - release: - types: [released] - -permissions: - contents: write - -jobs: - update: - runs-on: ubuntu-latest - timeout-minutes: 5 - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - ref: base - - - name: Update Changelog - uses: stefanzweifel/changelog-updater-action@v1 - with: - latest-version: ${{ github.event.release.name }} - release-notes: ${{ github.event.release.body }} - - - name: Commit updated CHANGELOG - uses: stefanzweifel/git-auto-commit-action@v5 - with: - branch: base - commit_message: "chore: update `CHANGELOG`" - file_pattern: CHANGELOG.md diff --git a/package.json b/package.json index edc938d..bc576c5 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "private": true, + "version": "0.3.0-alpha", "type": "module", "scripts": { "style:check": "eslint --config tools/eslint/.eslintrc.cjs --ignore-path tools/eslint/.eslintignore resources/js --ext .js,.ts,.vue", @@ -82,4 +83,4 @@ "vue-codemirror": "^6.1.1", "vue-sonner": "^2.0.8" } -} +} \ No newline at end of file diff --git a/resources/js/pages/Settings.vue b/resources/js/pages/Settings.vue index 463b18a..f9fc6c7 100644 --- a/resources/js/pages/Settings.vue +++ b/resources/js/pages/Settings.vue @@ -28,7 +28,7 @@ defineOptions({ name: 'SettingsPage', }); -const VERSION = 'v0.2.0-alpha'; +const VERSION = 'v0.3.0-alpha'; /* * Stores.