140 lines
3.9 KiB
YAML
140 lines
3.9 KiB
YAML
name: CI
|
|
on:
|
|
push:
|
|
branches:
|
|
- '**'
|
|
pull_request:
|
|
branches:
|
|
- '**'
|
|
|
|
env:
|
|
VER: 0.1.2
|
|
|
|
# If a 403 error occurs, make sure to set content permission to write
|
|
# see: https://github.com/go-semantic-release/action/issues/27
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: stackit-docker
|
|
steps:
|
|
- name: CI checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup GO
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
# go-version: 1.26
|
|
go-version-file: 'go.mod'
|
|
cache-dependency-path: 'go.sum'
|
|
|
|
- name: GO Linting
|
|
uses: golangci/golangci-lint-action@v9
|
|
with:
|
|
version: v2.11
|
|
|
|
# build:
|
|
# runs-on: stackit-docker
|
|
## strategy:
|
|
## fail-fast: true
|
|
## matrix:
|
|
## node: [10, 12]
|
|
# steps:
|
|
# - uses: actions/checkout@v6
|
|
#
|
|
# - uses: actions/setup-node@v1
|
|
# with:
|
|
# node-version: ${{ matrix.node }}
|
|
# - run: npm ci
|
|
# - run: npm test
|
|
release:
|
|
runs-on: stackit-docker
|
|
# needs: build
|
|
outputs:
|
|
tag: ${{ steps.create_release.outputs.tag }}
|
|
steps:
|
|
- name: "🖅 [START] release workflow"
|
|
if: ${{ always() }}
|
|
uses: https://stackit-solutions.git.onstackit.cloud/actions/notify@v${{ env.VER }}
|
|
with:
|
|
title: "[START] release workflow (${{ forgejo.run_number }})"
|
|
author: ${{ forgejo.actor }}
|
|
giturl: ${{ forgejo.server_url }}
|
|
iconslug: instacart
|
|
actionid: ${{ forgejo.run_number }}
|
|
webhook: "${{ secrets.WEBHOOK_URL }}"
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
# - name: Semantic Release
|
|
# uses: go-semantic-release/action@v1
|
|
# id: semrel
|
|
# with:
|
|
# github-token: ${{ env.FORGEJO_TOKEN }}
|
|
# allow-initial-development-versions: true
|
|
# # update-file: package.json
|
|
# changelog-file: CHANGELOG.md
|
|
# changelog-generator-opt: "emojis=true"
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Create Release
|
|
env:
|
|
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
|
id: create_release
|
|
run: |
|
|
npx \
|
|
-p semantic-release \
|
|
-p @semantic-release/commit-analyzer \
|
|
-p @semantic-release/release-notes-generator \
|
|
-p @semantic-release/changelog \
|
|
-p @semantic-release/git \
|
|
semantic-release
|
|
echo "tag=$(git describe --tags --abbrev=0)" >> $FORGEJO_OUTPUT
|
|
|
|
- name: Login to Docker Hub
|
|
if: steps.create_release.outputs.tag != ''
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: ${{ forgejo.server_url }}
|
|
username: ${{ vars.GIT_USERNAME }}
|
|
password: ${{ secrets.GIT_PAT }}
|
|
|
|
# - name: Set up QEMU
|
|
# if: steps.semrel.outputs.version != ''
|
|
# uses: docker/setup-qemu-action@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
if: steps.create_release.outputs.tag != ''
|
|
uses: docker/setup-buildx-action@v4
|
|
|
|
- name: Build only
|
|
if: steps.create_release.outputs.tag == ''
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
push: false
|
|
tags: actions/notify-slim:dev
|
|
|
|
- name: Build and push
|
|
if: steps.create_release.outputs.tag != ''
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
push: true
|
|
tags: actions/notify-slim:${{ steps.create_release.outputs.tag }}
|
|
|
|
- name: "🖅 [END] release workflow"
|
|
if: ${{ always() }}
|
|
uses: https://stackit-solutions.git.onstackit.cloud/actions/notify@v${{ env.VER }}
|
|
with:
|
|
title: "[END] release workflow (${{ forgejo.run_number }})"
|
|
author: ${{ forgejo.actor }}
|
|
giturl: ${{ forgejo.server_url }}
|
|
iconslug: instacart
|
|
actionid: ${{ forgejo.run_number }}
|
|
webhook: "${{ secrets.WEBHOOK_URL }}"
|
|
status: 'completed'
|