Skip to content

Same workflow for release and normal push with conditional execution #26

Same workflow for release and normal push with conditional execution

Same workflow for release and normal push with conditional execution #26

Workflow file for this run

name: release
on:
push: {}
jobs:
test-ci:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Install Prerequisites
run: sudo ./CI/install-prerequisites-manually.sh
- name: Install AI-CLI
run: |
sudo make install && source /etc/environment
- name: Prepare Tests
run: ./CI/setup-for-tests.sh
- name: Execute Tests
id: exec-tests
run: |
./CI/run-tests.sh 1> >( ts > stdout.txt) 2> >( ts > stderr.txt )
continue-on-error: true
- name: show stdout
run: cat stdout.txt
- name: show stderr
run: cat stderr.txt
- name: check on failures
if : steps.exec-tests.outcome != 'success'
run: exit 1
publish:
runs-on: ubuntu-latest
needs: test-ci
if: ${{ startsWith(github.ref, 'refs/tags/v') && needs.test-ci.result == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Prerequisites
run: sudo ./CI/install-prerequisites-manually.sh
- name: Install AI-CLI
run: |
sudo make install && source /etc/environment
- name: Build artifact
run: sudo make build -e VERSION=${{ github.REF_NAME }}
- name: Rename artifact
id: rename-artifact
run: mv src.deb ai-cli.deb
# Upload the artifact to the release
- name: Get Release ID
id: get_release
run: echo "::set-output name=release_id::$(jq -r '.release.id' $GITHUB_EVENT_PATH)"
- name: Upload Release Asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >-
gh release upload
'${{ github.ref_name }}' ai-cli.deb
--repo '${{ github.repository }}'