diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..2a11b39e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,56 @@ +name: Release +on: + push: + branches: + - main + pull_request: + branches: + - main + +permissions: + contents: write + +jobs: + release: + name: From changelog + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Get latest release info + id: query-release-info + uses: release-flow/keep-a-changelog-action@v2 + with: + command: query + version: latest + + - name: Display release info + run: | + echo "Version: ${{ steps.query-release-info.outputs.version }}" + echo "Date: ${{ steps.query-release-info.outputs.release-date }}" + echo "${{ steps.query-release-info.outputs.release-notes }}" + + - name: Get latest release + id: latest-release + uses: actions/github-script@v7 + continue-on-error: true + with: + script: | + return await github.rest.repos.getReleaseByTag({ + owner: context.repo.owner, + repo: context.repo.repo, + tag: "v${{ steps.query-release-info.outputs.version }}" + }) + - name: Create release + uses: actions/github-script@v7 + if: steps.latest-release.outcome != 'success' + with: + script: | + github.rest.repos.createRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + tag_name: "v${{ steps.query-release-info.outputs.version }}", + target_commitish: context.sha + name: "v${{ steps.query-release-info.outputs.version }}" + body: "${{ steps.query-release-info.outputs.release-notes }}" + }) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07dfe08e..512cffe1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,18 +16,18 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Switch from mitchellh/mapstructure to go-viper/mapstructure (#69). -## [v0.3.0] - 11/17/2023 +## [0.3.0] - 2023-11-17 ### Changed - [BREAKING] Redesign API. -## [v0.2.0] - 3/18/2023 +## [0.2.0] - 2023-03-18 ### Removed - Remove file.WithLog to favor standard log.Printf (#32). -## [v0.1.0] - 3/12/2023 +## [0.1.0] - 2023-03-12 Initial alpha release.