mirror of
https://github.com/lukaszraczylo/go-simple-graphql.git
synced 2026-10-12 00:45:31 +00:00
67 lines
1.8 KiB
YAML
67 lines
1.8 KiB
YAML
name: Test and release
|
|
|
|
on:
|
|
push:
|
|
paths-ignore:
|
|
- '**.md'
|
|
branches:
|
|
- "*"
|
|
|
|
jobs:
|
|
prepare:
|
|
name: Preparing build context
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
RELEASE_VERSION: ${{ steps.get_env.outputs.RELEASE_VERSION }}
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: '0'
|
|
- name: Setting environment variables
|
|
id: get_env
|
|
run: |
|
|
TMP_GITHUB_COMMITS_COUNT=$(git rev-list --count HEAD)
|
|
TMP_GITHUB_COUNT_NUMBER=$(echo ${GITHUB_RUN_NUMBER})
|
|
echo "::set-output name=RELEASE_VERSION::1.$TMP_GITHUB_COMMITS_COUNT.$TMP_GITHUB_COUNT_NUMBER"
|
|
|
|
tests:
|
|
name: Run unit tests
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
CI: true
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v2
|
|
- name: Run unit tests
|
|
uses: cedrickring/[email protected]
|
|
with:
|
|
args: |
|
|
make prepare;
|
|
make test CI_RUN=${CI}
|
|
- name: Codecov integration
|
|
uses: codecov/codecov-action@v1
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
files: coverage.txt
|
|
|
|
release:
|
|
name: Create Release
|
|
runs-on: ubuntu-latest
|
|
needs: [ prepare, tests ]
|
|
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
- name: Create Release
|
|
id: create_release
|
|
uses: actions/create-release@main
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: v${{ needs.prepare.outputs.RELEASE_VERSION }}
|
|
release_name: v${{ needs.prepare.outputs.RELEASE_VERSION }}
|
|
body: |
|
|
Released automatically after merge to master / main.
|
|
draft: false
|
|
prerelease: false |