Merge branch 'main' of https://github.com/STARTcloud/core_provisioner #22
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/[email protected] | |
if: ${{ steps.release.outputs.release_created }} | |
with: | |
files: core/ Vagrantfile provisioners/ | |
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 Core" > core/version.rb | |
echo " VERSION = '${{ needs.release.outputs.my_output }}'" >> core/version.rb | |
echo "end" >> core/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 core/version.rb | |
git commit -m "Update version.rb to ${{ needs.release.outputs.my_output }}" | |
- name: "Pushing changes" | |
uses: ad-m/[email protected] | |
with: | |
branch: submodule | |
github_token: ${{ secrets.GITHUB_TOKEN }} |