initial commit
This commit is contained in:
118
.gitea/workflows/build.yml
Normal file
118
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,118 @@
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 6 * * *'
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
branches:
|
||||
- "*"
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
build: ${{ steps.new_version.outputs.build }}
|
||||
version: ${{ steps.new_version.outputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Get latest release version
|
||||
id: new_version
|
||||
run: |
|
||||
CURRENT=`cat .version`
|
||||
LATEST=`curl --silent https://api.github.com/repos/PlakarKorp/plakar/releases/latest | jq -r .tag_name | sed "s/v//"`
|
||||
echo "current registered version: $CURRENT"
|
||||
echo "latest version on remote repo: $LATEST"
|
||||
echo "version=$LATEST" >> $GITHUB_OUTPUT
|
||||
if awk "BEGIN {exit !($LATEST > $CURRENT)}"; then
|
||||
echo $LATEST > .version
|
||||
echo "build=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "build=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
echo "VERSION=`cat .version`" >> $GITHUB_ENV
|
||||
|
||||
- uses: stefanzweifel/git-auto-commit-action@v6
|
||||
with:
|
||||
branch: main
|
||||
file_pattern: '.version'
|
||||
commit_user_name: gitea-actions[bot]
|
||||
commit_user_email: no-reply@brainsys.io
|
||||
commit_message: gitea-actions auto commit - update version
|
||||
tagging_message: '${{ env.VERSION }}'
|
||||
push_options: '--force'
|
||||
|
||||
- name: DEBUG - build value
|
||||
run: echo "${{ steps.new_version.outputs.build }}"
|
||||
|
||||
- name: DEBUG - version value
|
||||
run: echo "${{ steps.new_version.outputs.version }}"
|
||||
|
||||
build:
|
||||
needs: validate
|
||||
if: needs.validate.outputs.build == 'true'
|
||||
timeout-minutes: 2
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set version to env vars
|
||||
run: |
|
||||
echo "${{ needs.validate.outputs.version }}"
|
||||
echo "VERSION=${{ needs.validate.outputs.version }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '>=1.20'
|
||||
|
||||
- name: Checkout varnish exporter
|
||||
run: git clone https://github.com/PlakarKorp/plakar.git plakar
|
||||
|
||||
- name: Build plakar exporter for GNU/Linux / amd64
|
||||
run: GOOS=linux GOARCH=amd64 go build -o ../bin/plakar-amd64
|
||||
working-directory: plakar
|
||||
|
||||
- name: Create debian / amd64 dir tree
|
||||
run: |
|
||||
mkdir -p plakar-amd64/usr/bin
|
||||
mkdir -p plakar-amd64/DEBIAN
|
||||
|
||||
- name: Copy binaries
|
||||
run: |
|
||||
cp bin/plakar-amd64 plakar-amd64/usr/bin/plakar
|
||||
|
||||
- name: Prepare amd64 control file
|
||||
run: |
|
||||
echo "Package: plakar" > plakar-amd64/DEBIAN/control
|
||||
echo "Version: $VERSION" >> plakar-amd64/DEBIAN/control
|
||||
echo "Maintainer: Ludovic Cartier <ludovic.cartier@alterway.fr>" >> plakar-amd64/DEBIAN/control
|
||||
echo "Architecture: amd64" >> plakar-amd64/DEBIAN/control
|
||||
echo "Homepage: https://git.brainsys.io/packages/plakar" >> plakar-amd64/DEBIAN/control
|
||||
echo "Description: Plakar package for GNU/Linux Debian" >> plakar-amd64/DEBIAN/control
|
||||
|
||||
- name: Build deb files
|
||||
run: |
|
||||
dpkg -b plakar-amd64 bin/plakar_$VERSION-1_amd64.deb
|
||||
|
||||
- name: Release packages
|
||||
run: |
|
||||
curl -s -u "${{ secrets.PACKAGE_TOKEN }}" --upload-file bin/plakar_$VERSION-1_amd64.deb \
|
||||
https://git.brainsys.io/api/packages/packages/debian/pool/stable/main/upload
|
||||
|
||||
- name: Create release
|
||||
uses: akkuman/gitea-release-action@v1
|
||||
with:
|
||||
tag_name: "${{ env.VERSION }}"
|
||||
files: |-
|
||||
bin/**
|
||||
token: "${{ secrets.RELEASE_TOKEN }}"
|
||||
|
||||
- name: Send notification to mattermost
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
SLACK_WEBHOOK: "${{ secrets.MATTERMOST_WEBHOOK }}"
|
||||
SLACK_USERNAME: gitea-bot
|
||||
SLACK_CHANNEL: gitea-actions
|
||||
SLACK_COLOR: "${{ job.status }}"
|
||||
SLACK_CUSTOM_PAYLOAD: '{"username": "gitea-bot", "icon_url": "https://w7.pngwing.com/pngs/940/571/png-transparent-gitea-hd-logo-thumbnail.png", "text": "plakar build has just finished in version ${{ env.VERSION }} !"}'
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*~
|
||||
*.swp
|
21
README.md
Normal file
21
README.md
Normal file
@@ -0,0 +1,21 @@
|
||||
plakar
|
||||
======
|
||||
|
||||
Simple repository for packaging [plakar](https://plakar.io/) on Debian System, for amd64 and arm64 architectures.
|
||||
|
||||
How does it work ?
|
||||
------------------
|
||||
|
||||
A new CI/CD pipeline is initiaded every morning at 6PM.
|
||||
It check if a new version is avaible.
|
||||
If so, a new build is launched, and a new Debian package generated.
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
MIT
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
Written by Ludovic Cartier <ludovic.cartier@brainsys.io>
|
Reference in New Issue
Block a user