publish #72
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: automatic_test_build_publish | |
on: | |
- repository_dispatch | |
- workflow_dispatch | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository with submodules | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Git Submodule Update | |
run: | | |
git pull --recurse-submodules | |
git submodule update --init --recursive | |
git submodule update --remote --recursive | |
- name: Setup buf | |
uses: bufbuild/buf-setup-action@v1 | |
- name: Lint protofiles with buf | |
uses: bufbuild/buf-lint-action@v1 | |
- name: Generate buf files | |
run: buf generate | |
- name: Fetch release version | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: | | |
echo TAG_NAME=$(gh release view --repo https://github.com/ArunaStorage/ArunaAPI --json tagName | jq .tagName -r) >> $GITHUB_ENV | |
echo RELEASE_NAME=$(gh release view --repo https://github.com/ArunaStorage/ArunaAPI --json name | jq .name -r) >> $GITHUB_ENV | |
echo RELEASE_BODY=$(gh release view --repo https://github.com/ArunaStorage/ArunaAPI --json body | jq .body -r) >> $GITHUB_ENV | |
- name: Commit files | |
run: | | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add -A | |
git diff-index --quiet HEAD || git commit -m "Update version to $TAG_NAME" -a | |
git tag -a $TAG_NAME -m "Published new version: $TAG_NAME, see API for detailed changelog." | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tags: true | |
force: true | |
push_to_submodules: "no" | |
- name: Try delete (old) release if exists | |
run: gh release delete $TAG_NAME | |
continue-on-error: true | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create release | |
run: gh release create $TAG_NAME --title "$RELEASE_NAME" --notes "$RELEASE_BODY" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |