add validate step
This commit is contained in:
@@ -8,30 +8,38 @@ on:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
status: ${{ steps.new_version.outputs.status }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4 # default goes to /workspace/Clients/xxx
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: test - add env file
|
||||
- name: Get latest release version
|
||||
id: new_version
|
||||
run: |
|
||||
echo "MY_GLOBAL_VAR=newvalue" > .version
|
||||
#git config --global user.name 'gitea-actions'
|
||||
#git config --global user.email 'no-reply@brainsys.io'
|
||||
#git add .version
|
||||
#git commit -m "Update version variable"
|
||||
#git push
|
||||
CURRENT=`cat .version`
|
||||
LATEST=`curl --silent https://api.github.com/repos/jonnenauha/prometheus_varnish_exporter/releases/latest | jq -r .tag_name | sed "s/v//"`
|
||||
if [[ $LATEST -gt $CURRENT ]]; then echo $LATEST > .version; echo "status=build" >> $GITEA_OUTPUT; done
|
||||
|
||||
- uses: stefanzweifel/git-auto-commit-action@v6
|
||||
with:
|
||||
branch: main
|
||||
commit_message: gitea-actions auto commit
|
||||
file_pattern: '.version'
|
||||
commit_user_name: gitea-actions[bot]
|
||||
commit_user_email: no-replay@brainsys.io
|
||||
commit_message: gitea-actions auto commit - update version
|
||||
push_options: '--force'
|
||||
|
||||
build:
|
||||
if: steps.validate.output.status == build
|
||||
runs-on: ubuntu-latest
|
||||
needs: validate
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Get version
|
||||
run: |
|
||||
TAG=${{ gitea.ref_name }}
|
||||
echo "VERSION=${TAG#v}" | tee -a $GITEA_ENV
|
||||
run: VERSION=`cat .version`
|
||||
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@v4
|
||||
|
Reference in New Issue
Block a user