Release prep v39.0.0 #108
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: Pull Request Merge to Release Prep | |
on: | |
pull_request: | |
types: | |
- closed | |
jobs: | |
if_merged: | |
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'release-prep') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: "Get version" | |
id: "get_version" | |
run: | | |
version=$(grep -o "version = '[^']*'" .version | awk -F"'" '{print $2}') | |
echo "version=$version" >> $GITHUB_OUTPUT | |
latest_tag=$(curl -sL https://api.github.com/repos/${GITHUB_REPOSITORY}/tags | jq -r '.[0].name') | |
current_version=$(echo "$latest_tag" | cut -d'.' -f1 | sed 's/[^0-9]//g') | |
new_version=$(echo $version | cut -d'.' -f1) | |
echo "current_version=$current_version" >> $GITHUB_OUTPUT | |
if [ "$new_version" -gt "$current_version" ]; then | |
echo "new : $new_version" | |
echo "main" | |
echo "major_version_upgrade=true" >> $GITHUB_OUTPUT | |
echo "base_branch=main" >> $GITHUB_OUTPUT | |
else | |
echo $current_version.0.0 | |
echo "current: $current_version" | |
echo "major_version_upgrade=false" >> $GITHUB_OUTPUT | |
echo "base_branch=$current_version.0.0" >> $GITHUB_OUTPUT | |
fi | |
#- name: "Generate release notes" | |
# run: | | |
# export GH_HOST=github.com | |
# gh extension install chelnak/gh-changelog | |
# gh changelog get --latest > OUTPUT.md | |
# env: | |
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Create release" | |
run: | | |
echo "$base_branch" | |
gh release create v${{ steps.get_version.outputs.version }} --title v${{ steps.get_version.outputs.version }} --target ${{ steps.get_version.outputs.base_branch }} | |
git branch | |
export GH_HOST=github.com | |
gh extension install chelnak/gh-changelog | |
gh changelog get --latest > OUTPUT.md | |
gh release edit v${{ steps.get_version.outputs.version }} -F OUTPUT.md | |
ls -lah | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
#- name: "Setup ruby" | |
# uses: "ruby/setup-ruby@v1" | |
# with: | |
# ruby-version: "3.1.2" | |
# bundler-cache: "true" | |
#- name: Install jq and bundle install | |
# run: | | |
# sudo apt-get install jq libjq-dev | |
# export RUBYJQ_USE_SYSTEM_LIBRARIES=1 | |
# bundle install | |
#- name: "Bundle environment" | |
# run: | | |
# echo ::group::bundler environment | |
# bundle env | |
# echo ::endgroup:: | |
- name: "Build a new release" | |
run: | | |
echo "Building new release" | |
# mkdir -p /home/runner/work/puppet-forge-api/puppet-forge-api/pkg && bundle exec harrison package | |
#- name: "Setup twingate" | |
# uses: twingate/github-action@v1 | |
# with: | |
# service-key: ${{ secrets.TWINGATE_KEY }} | |
#- name: "Deploy" | |
# env: | |
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
# run: | | |
# export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID | |
# export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY | |
# mkdir -p ~/.ssh/ | |
# echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
# echo "${{ secrets.SSH_PUB_KEY }}" > ~/.ssh/id_rsa.pub | |
# chmod 600 ~/.ssh/id_rsa | |
# chmod 600 ~/.ssh/id_rsa.pub | |
# version=$(ls -tr pkg | tail -1) | |
# for env in dev stage prod; do | |
# echo "Starting deploy to $env" | |
# eval "$(ssh-agent -s)" | |
# ssh-add ~/.ssh/id_rsa | |
# cd /home/runner/work/puppet-forge-api/puppet-forge-api && bundle exec harrison deploy pkg/$version --env $env --no-confirm | |
# echo "Successfully deployed to $env" | |
# done | |