Enable deployment of engine
and federation-api
on a single server
#38
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: Release | |
on: | |
pull_request: | |
branches: | |
- main | |
types: [ closed ] | |
jobs: | |
changelog: | |
uses: ./.github/workflows/changelog.yml | |
release: | |
if: github.event.pull_request.merged == true | |
needs: [ changelog ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }} | |
- name: Configure Git author | |
run: | | |
git config --global user.name "Open Terms Archive Release Bot" | |
git config --global user.email "release-bot@opentermsarchive.org" | |
- name: Install Semver | |
run: npm i -g semver | |
- name: Get current version | |
id: get_current_version | |
uses: mikefarah/yq@master | |
with: | |
cmd: yq '.version' galaxy.yml | |
- name: Bump version | |
run: | | |
echo "Found release type '${{ env.RELEASE_TYPE }}'" | |
echo "NEW_VERSION=$(semver -i $RELEASE_TYPE ${{ steps.get_current_version.outputs.result }})" >> $GITHUB_ENV | |
env: | |
RELEASE_TYPE: ${{ needs.changelog.outputs.release_type }} | |
- name: Update changelog unreleased section with new version | |
uses: superfaceai/release-changelog-action@v2 | |
with: | |
path-to-changelog: CHANGELOG.md | |
version: ${{ env.NEW_VERSION }} | |
operation: release | |
format: markdownlint | |
- name: Build Collection | |
uses: artis3n/ansible_galaxy_collection@v2 | |
with: | |
api_key: '${{ secrets.GALAXY_API_KEY }}' | |
galaxy_version: '${{ env.NEW_VERSION }}' | |
build: true | |
publish: false | |
- name: Commit CHANGELOG.md and create tag | |
run: | | |
git add "CHANGELOG.md" | |
git add "galaxy.yml" | |
git commit -m "Release ${{ env.NEW_VERSION }}" | |
git tag ${{ env.NEW_VERSION }} | |
- name: Run status checks for release commit on temporary branch # Use temporary branch to enable pushing commits to this branch protected by required status checks | |
uses: CasperWA/push-protected@v2 | |
with: | |
token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }} | |
branch: main | |
unprotect_reviews: true | |
- name: Push changes to repository | |
run: git push origin && git push --tags | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Read version changelog | |
uses: superfaceai/release-changelog-action@v2 | |
id: get-changelog | |
with: | |
path-to-changelog: CHANGELOG.md | |
version: ${{ env.NEW_VERSION }} | |
operation: read | |
- name: Update GitHub release with changelog | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.NEW_VERSION }} | |
body: ${{ steps.get-changelog.outputs.changelog }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish Collection on Ansible Galaxy | |
uses: artis3n/ansible_galaxy_collection@v2 | |
with: | |
api_key: '${{ secrets.GALAXY_API_KEY }}' | |
build: false | |
publish: true | |