Compare commits
28 Commits
596baba5ef
...
v0.1.9
Author | SHA1 | Date | |
---|---|---|---|
570b5abfa0 | |||
8f938f999e | |||
2249d1a776 | |||
37de21f06b | |||
b9d5ade0f1 | |||
921b4a9664 | |||
0e9555e3f7 | |||
19c7aaaca1 | |||
068c67d0d9 | |||
4c6635f989 | |||
98080df509 | |||
286f72eac7 | |||
d49977815d | |||
b012693c21 | |||
e385eb94f4 | |||
285ff89cb0 | |||
fe45d901e4 | |||
ba6e201adc | |||
5867cfc3e1 | |||
8771e1ee02 | |||
2be4331a6e | |||
98754be109 | |||
9ee2750534 | |||
9920c94a8b | |||
b7bc477d2e | |||
ab11665665 | |||
37468b6785 | |||
471767c4ed |
@@ -3,14 +3,8 @@ name: Gitea CI/CD
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches: [ "development", "main", "staging"]
|
branches: [ "development", "main", "staging" ]
|
||||||
tags: [ "v*.*.*" ]
|
tags: [ "v*.*.*" ]
|
||||||
#pull_request:
|
|
||||||
#branches: [ "development", "main", "staging" ]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
packages: write
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOTNET_VERSION: '8.0.x'
|
DOTNET_VERSION: '8.0.x'
|
||||||
@@ -18,8 +12,12 @@ env:
|
|||||||
REGISTRY_URL: git.triggermeelmo.com
|
REGISTRY_URL: git.triggermeelmo.com
|
||||||
DOCKER_PLATFORMS: 'linux/amd64,linux/arm64'
|
DOCKER_PLATFORMS: 'linux/amd64,linux/arm64'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-test:
|
dotnet-build-and-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
@@ -45,9 +43,12 @@ jobs:
|
|||||||
|
|
||||||
set-tag:
|
set-tag:
|
||||||
name: Set Tag Name
|
name: Set Tag Name
|
||||||
|
needs: [dotnet-build-and-test]
|
||||||
|
#if: ${{ !failure() && !cancelled() && github.event_name != 'pull_request' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
tag_name: ${{ steps.set_tag.outputs.tag_name }}
|
tag_name: ${{ steps.set_tag.outputs.tag_name }}
|
||||||
|
should_tag: ${{ steps.set_tag.outputs.should_tag }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -71,19 +72,33 @@ jobs:
|
|||||||
major=$((major + 1))
|
major=$((major + 1))
|
||||||
minor=0
|
minor=0
|
||||||
patch=0
|
patch=0
|
||||||
|
new_tag="v${major}.${minor}.${patch}"
|
||||||
|
echo "tag_name=${new_tag}" >> $GITHUB_OUTPUT
|
||||||
|
echo "should_tag=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "Creating new major version tag: ${new_tag}"
|
||||||
|
|
||||||
elif [[ "${GITHUB_REF}" == "refs/heads/development" ]]; then
|
elif [[ "${GITHUB_REF}" == "refs/heads/development" ]]; then
|
||||||
minor=$((minor + 1))
|
minor=$((minor + 1))
|
||||||
patch=0
|
patch=0
|
||||||
elif [[ "${GITHUB_REF}" == "refs/heads/staging" ]]; then
|
|
||||||
patch=$((patch + 1))
|
|
||||||
fi
|
|
||||||
|
|
||||||
new_tag="v${major}.${minor}.${patch}"
|
new_tag="v${major}.${minor}.${patch}"
|
||||||
echo "tag_name=${new_tag}" >> $GITHUB_OUTPUT
|
echo "tag_name=${new_tag}" >> $GITHUB_OUTPUT
|
||||||
|
echo "should_tag=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "Creating new minor version tag: ${new_tag}"
|
||||||
|
|
||||||
|
elif [[ "${GITHUB_REF}" == "refs/heads/staging" ]]; then
|
||||||
|
patch=$((patch + 1))
|
||||||
|
new_tag="v${major}.${minor}.${patch}"
|
||||||
|
echo "tag_name=${new_tag}" >> $GITHUB_OUTPUT
|
||||||
|
echo "should_tag=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "Creating new patch version tag: ${new_tag}"
|
||||||
|
fi
|
||||||
|
|
||||||
docker-build-and-push:
|
docker-build-and-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build-and-test, set-tag]
|
needs: [dotnet-build-and-test, set-tag]
|
||||||
|
if: |
|
||||||
|
needs.set-tag.outputs.should_tag == 'true' &&
|
||||||
|
github.event_name != 'pull_request'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -107,13 +122,15 @@ jobs:
|
|||||||
|
|
||||||
tag:
|
tag:
|
||||||
name: Create Tag
|
name: Create Tag
|
||||||
needs: [docker-build-and-push]
|
needs: [docker-build-and-push, set-tag]
|
||||||
|
if: |
|
||||||
|
needs.set-tag.outputs.should_tag == 'true' &&
|
||||||
|
github.event_name != 'pull_request'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Set up Git user
|
- name: Set up Git user
|
||||||
run: |
|
run: |
|
||||||
@@ -121,6 +138,9 @@ jobs:
|
|||||||
git config user.email "actions@github.com"
|
git config user.email "actions@github.com"
|
||||||
|
|
||||||
- name: Create and push tag
|
- name: Create and push tag
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
|
echo "Creating new tag: ${{ needs.set-tag.outputs.tag_name }}"
|
||||||
git tag ${{ needs.set-tag.outputs.tag_name }}
|
git tag ${{ needs.set-tag.outputs.tag_name }}
|
||||||
git push origin ${{ needs.set-tag.outputs.tag_name }}
|
git push origin ${{ needs.set-tag.outputs.tag_name }}
|
Reference in New Issue
Block a user