Merge pull request #11 from STARTcloud/release-please--branches--main… #29
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: AUTO - Build, Release and Publish | |
on: | |
push: | |
branches: | |
- main | |
env: | |
app_name: core_provisioner | |
suffix: '' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
outputs: | |
my_output: ${{ steps.build_info.outputs.version }} | |
steps: | |
- name: "Running Release-Please" | |
id: release | |
uses: google-github-actions/release-please-action@v3 | |
with: | |
command: manifest | |
default-branch: main | |
package-name: core_provisioner | |
bump-minor-pre-major: true | |
bump-patch-for-minor-pre-major: true | |
version-file: "core/version.rb" | |
- name: "Checking out code" | |
uses: actions/checkout@v2 | |
if: ${{ steps.release.outputs.release_created }} | |
- name: "Displaying build info" | |
id: build_info | |
if: ${{ steps.release.outputs.release_created }} | |
run: | | |
echo "Ref: ${{ github.ref_name }}" | |
echo "Tag: ${{ steps.release.outputs.tag_name }}" | |
echo "App Name: ${{ env.app_name }}" | |
echo "Version: ${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}" | |
echo "::set-output name=version::${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}" | |
- name: "Zipping Output" | |
id: zip_artifact | |
uses: vimtor/action-zip@v1.2 | |
if: ${{ steps.release.outputs.release_created }} | |
with: | |
files: core/ | |
dest: ${{ env.app_name }}.zip | |
recursive: true | |
- name: "Creating release" | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
if: ${{ steps.release.outputs.release_created }} | |
with: | |
name: "${{ env.app_name }}: v${{ steps.build_info.outputs.version }}" | |
tag_name: ${{ env.app_name }}/v${{ steps.build_info.outputs.version }}${{ env.suffix }} | |
target_commitish: ${{ github.sha }} | |
body: | | |
This is a Production release of ${{ env.app_name }}. | |
draft: false | |
prerelease: false | |
files: | | |
${{ env.app_name }}.zip | |
fail_on_unmatched_files: true | |
update_submodule_version: | |
runs-on: ubuntu-latest | |
needs: release | |
if: ${{ needs.release.outputs.my_output }} | |
steps: | |
- name: "Checking out submodule branch" | |
uses: actions/checkout@v2 | |
with: | |
ref: submodule | |
- name: "Updating version.rb" | |
run: | | |
echo "Updating version.rb with new version" | |
echo "module CoreProvisioner" > version.rb | |
echo " VERSION = '${{ needs.release.outputs.my_output }}'" >> version.rb | |
echo "end" >> version.rb | |
- name: "Committing changes" | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add version.rb | |
git commit -m "Update version.rb to ${{ needs.release.outputs.my_output }}" | |
- name: "Pushing changes" | |
uses: ad-m/github-push-action@v0.6.0 | |
with: | |
branch: submodule | |
github_token: ${{ secrets.GITHUB_TOKEN }} |