Skip to content

Commit

Permalink
[e5ebbcb] New Docker Trigger Action release
Browse files Browse the repository at this point in the history
  • Loading branch information
mitch1009 committed Sep 9, 2024
1 parent e5ebbcb commit 8e7a74f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 52 deletions.
55 changes: 4 additions & 51 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,76 +4,29 @@ on:
tags:
- 'v*.*.*'
jobs:
build-docker-image:
name: Build Docker Image
runs-on: ubuntu-latest
outputs:
release_version: ${{ steps.version.outputs.version }}
pr_log: ${{ steps.pr-log.outputs.pr-log }}
commit_log: ${{ steps.pr-log.outputs.commit_log }}
steps:
- uses: actions/[email protected]
- name: Build and Push Docker Image
run: |
echo "standing by mode"
- name: get the versin from package.json
id: version
run: |
version=$(jq -r ".version" package.json)
echo "version=${version}"
echo "version=${version}" >> $GITHUB_OUTPUT
- name: Get PR titles and authors
id: pr-log
env:
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
run: |
PREVIOUS_TAG=$(git describe --tags --always --abbrev=0 HEAD^)
PR_LOG=$(gh pr list --search "is:merged merged:>$(git log -1 --format=%aI $PREVIOUS_TAG)" --json title,author --jq '.[] | " \n - [x] " + .title + " by @" + .author.login' | tr '\n' ', ')
echo "PR_LOG<<EOF" >> $GITHUB_ENV
echo "$PR_LOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "pr-log=$PR_LOG" >> $GITHUB_OUTPUT
# extract all commit logs from the last tag
git log --pretty=format:"%s" $PREVIOUS_TAG..HEAD
# format the commit logs
git log --pretty=format:"%s" $PREVIOUS_TAG..HEAD | sed 's/^/- /g'
echo "commit_log"=$(git log --pretty=format:"%s" $PREVIOUS_TAG..HEAD | sed 's/^/- /g') >> $GITHUB_OUTPUT
create-new-release:
name: Create New Release 🎉
runs-on: ubuntu-latest
needs: [build-docker-image]
# check if there is a new tag

permissions:
contents: write
id-token: write
pull-requests: write

steps:
- name: Checkout code
uses: actions/[email protected]
with:
fetch-depth: 0 # Fetch all history for all tags and branches

- name: Get contributors
env:
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
run: |
CONTRIBUTORS=$(gh api repos/${{ github.repository }}/contributors --jq 'map(.login) | join(", @")')
echo "CONTRIBUTORS=@$CONTRIBUTORS" >> $GITHUB_ENV
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
run: |
gh release create v${{ needs.build-docker-image.outputs.release_version }} \
--title "v${{ needs.build-docker-image.outputs.release_version }}" \
gh release create v$(jq -r ".version" package.json) \
--title "v$(jq -r ".version" package.json)" \
--notes "## 🎍 What's new in this release:
${{ needs.build-docker-image.outputs.commit_log }}
- [x] New Docker Image Release $(jq -r ".version" package.json )
## 🙏🏾 Thank You:
A big thank you to all our amazing engineers and maintainers
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### 1.0.12 (2024-09-09)

### 1.0.1 (2024-09-07)


Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "@mitch1009/docker-trigger",
"version": "1.0.11",
"version": "1.0.12",
"description": "docker trigger action",
"main": "index.js",
"scripts": {
"rel": "standard-version --sign --release-as patch --tag-prefix 'docker-trigger@'",
"rel:v": "standard-version --release-as patch",
"rel:local": "standard-version --release-as patch --tag-prefix 'docker-trigger@'",
"release": "standard-version --sign --release-as patch --tag-prefix 'docker-trigger@' "
},
"keywords": [],
Expand Down

0 comments on commit 8e7a74f

Please sign in to comment.