mirror of
https://github.com/reecetech/version-increment.git
synced 2025-12-21 06:25:44 +00:00
98 lines
2.3 KiB
YAML
98 lines
2.3 KiB
YAML
---
|
|
name: Test and Release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- '**'
|
|
tags-ignore:
|
|
- '**'
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Run ShellCheck
|
|
uses: ludeeus/action-shellcheck@2.0.0
|
|
with:
|
|
check_together: 'yes'
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup bats
|
|
uses: mig4/setup-bats@af9a00deb21b5d795cabfeaa8d9060410377686d # v1.2.0
|
|
with:
|
|
bats-version: 1.8.0
|
|
|
|
- name: Test
|
|
run: bats tests/*.bats
|
|
|
|
test-api:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
github_token: ${{ github.token }}
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Remove .git directory
|
|
run: rm -rf .git/
|
|
|
|
- name: Test lookup version (with API)
|
|
id: version-lookup
|
|
env:
|
|
use_api: 'true'
|
|
run: ./version-lookup.sh
|
|
|
|
- name: Check lookup result
|
|
shell: bash
|
|
run: '[[ -n "${{ steps.version-lookup.outputs.CURRENT_VERSION }}" ]]'
|
|
|
|
- name: Test increment version (with API)
|
|
id: version-increment
|
|
run: ./version-increment.sh
|
|
env:
|
|
current_version: ${{ steps.version-lookup.outputs.CURRENT_VERSION }}
|
|
scheme: calver
|
|
use_api: 'true'
|
|
|
|
- name: Check increment result
|
|
shell: bash
|
|
run: '[[ "$(date +%Y.%m)" == "$(echo "${{ steps.version-increment.outputs.VERSION }}" | cut -d "." -f 1-2)" ]]'
|
|
|
|
release:
|
|
needs:
|
|
- lint
|
|
- test
|
|
- test-api
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Lookup version
|
|
id: version-lookup
|
|
run: ./version-lookup.sh
|
|
|
|
- name: Increment version
|
|
id: version-increment
|
|
run: ./version-increment.sh
|
|
env:
|
|
current_version: ${{ steps.version-lookup.outputs.CURRENT_VERSION }}
|
|
scheme: calver
|
|
|
|
- name: Release version
|
|
uses: softprops/action-gh-release@v1
|
|
if: ${{ github.ref_name == github.event.repository.default_branch }}
|
|
with:
|
|
draft: false
|
|
prerelease: false
|
|
tag_name: "${{ steps.version-increment.outputs.VERSION }}"
|