Build(deps): bump github.com/btnguyen2k/consu/reddo from 0.1.8 to 0.1.9 in /semita #51
Workflow file for this run
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: semita | |
on: | |
push: | |
branches: [ 'semita', 'dev/semita', 'master' ] | |
paths: [ 'semita/**', '.github/workflows/semita.yaml' ] | |
pull_request: | |
types: [ 'opened', 'closed' ] | |
branches: [ 'semita', 'master' ] | |
paths: [ 'semita/**', '.github/workflows/semita.yaml' ] | |
jobs: | |
TestSemita: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go: [ '1.13', '1.14', '1.15', '1.16', '1.17', '1.18', '1.19', '1.20', '1.21', 'stable' ] | |
name: Test semita with Go ${{ matrix.go }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go env | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Run tests | |
run: | | |
go version | |
cd ./semita | |
go test -cover -coverprofile=../coverage_semita.txt -v -count 1 -p 1 . | |
cd .. | |
- name: Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
flags: semita | |
name: semita | |
ReleaseDryRun: | |
runs-on: ubuntu-latest | |
needs: [ 'TestSemita' ] | |
outputs: | |
RESULT: ${{ steps.semrelease.outputs.result }} | |
VERSION: ${{ steps.semrelease.outputs.releaseVersion }} | |
RELEASE_NOTES: ${{ steps.semrelease.outputs.releaseNotes }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Release (dry-run) | |
id: semrelease | |
uses: btnguyen2k/action-semrelease@v3 | |
with: | |
dry-run: true | |
auto-mode: true | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
tag-major-release: false | |
tag-minor-release: false | |
branches: semita,dev/semita | |
tag-prefix: 'semita/v' | |
tag-only: true | |
path: 'semita/' | |
Release: | |
runs-on: ubuntu-latest | |
if: | | |
github.event.pull_request.merged == true && | |
github.ref == 'semita' | |
needs: [ 'ReleaseDryRun' ] | |
permissions: | |
contents: write | |
outputs: | |
RESULT: ${{ needs.ReleaseDryRun.outputs.RESULT }} | |
VERSION: ${{ needs.ReleaseDryRun.outputs.VERSION }} | |
RELEASE_NOTES: ${{ needs.ReleaseDryRun.outputs.RELEASE_NOTES }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Update module meta | |
run: | | |
RESULT='${{ needs.ReleaseDryRun.outputs.RESULT }}' | |
VERSION='${{ needs.ReleaseDryRun.outputs.VERSION }}' | |
RELEASE_NOTES='${{ needs.ReleaseDryRun.outputs.RELEASE_NOTES }}' | |
MODULE=semita | |
echo "🕘 Updating module meta..." | |
echo " - RESULT: ${RESULT}" | |
echo " - VERSION: ${VERSION}" | |
echo " - RELEASE_NOTES: ${RELEASE_NOTES}" | |
if [ "${RESULT}" == "SUCCESS" ]; then | |
DATE=`date +%Y-%m-%d` | |
FILE_CHANGELOG="${MODULE}/CHANGELOG.md" | |
FILE_MODULE="${MODULE}/module.go" | |
head -1 ${FILE_CHANGELOG} > .temp.md | |
echo -e "\n## ${DATE} - v${VERSION}\n\n${RELEASE_NOTES}" >> .temp.md | |
tail -n +2 ${FILE_CHANGELOG} >> .temp.md | |
mv -f .temp.md ${FILE_CHANGELOG} | |
echo ========== content of ${FILE_CHANGELOG} ========== | |
cat ${FILE_CHANGELOG} | |
sed -i -E "s/^(\s*Version\s*=\s*)\"[^\"]+\"/\1\"${VERSION}\"/" ${FILE_MODULE} | |
echo ========== content of ${FILE_MODULE} ========== | |
cat ${FILE_MODULE} | |
echo ========== update .go files ========== | |
sed -i -E "s/<<VERSION>>/v${VERSION}/" ${MODULE}/*.go | |
echo ========== commit updates ========== | |
git config --global user.email "<>" | |
git config --global user.name "CI Build" | |
git commit -am "Update ${FILE_CHANGELOG} and ${FILE_MODULE} for new version ${VERSION}" | |
git push origin ${MODULE} | |
echo ========== tag ========== | |
git tag -f -a "${MODULE}/v${VERSION}" -m "Release ${MODULE}/v${VERSION}" | |
git push origin "${MODULE}/v${VERSION}" -f | |
echo "✅ Done." | |
else | |
echo "❎ SKIPPED." | |
fi | |
MergeToMaster: | |
runs-on: ubuntu-latest | |
needs: [ 'Release' ] | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: actions/github-script@v7 | |
env: | |
RESULT: ${{ needs.Release.outputs.RESULT }} | |
RELEASE_NOTES: ${{ needs.Release.outputs.RELEASE_NOTES }} | |
with: | |
script: | | |
if (process.env['RESULT'] != 'SUCCESS') { | |
console.log('❎ SKIPPED.'); | |
return; | |
} | |
const {data: pr} = await github.rest.pulls.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
title: "Merge branch semita to master after releasing new version ${{ needs.Release.outputs.VERSION }}", | |
body: process['env']['RELEASE_NOTES'], | |
head: 'semita', | |
base: 'master', | |
maintainer_can_modify: true, | |
}); | |
console.log('✅ Created PR: ', pr); |