update readme (#120) #374
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous Integration | |
concurrency: ci-${{ github.ref }} | |
on: | |
push: | |
tags-ignore: | |
- "*" | |
branches: | |
- "main" | |
pull_request: | |
release: | |
types: [published] | |
workflow_dispatch: | |
env: | |
OBS_USER: ${{ secrets.OBS_USER }} | |
OBS_PASS: ${{ secrets.OBS_PASS }} | |
OBS_PROJECT: ${{ secrets.OBS_PROJECT}} | |
jobs: | |
test-helm-charts: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: azure/[email protected] | |
with: | |
version: v3.4.0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.7 | |
- name: Set up chart-testing | |
uses: helm/[email protected] | |
- name: Lint | |
run: ct lint --config=ct.yaml --lint-conf=helmlintconf.yaml | |
create-artifact: | |
runs-on: ubuntu-20.04 | |
needs: [test-helm-charts] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: compress | |
run: | | |
set -x | |
find ./charts/ -maxdepth 1 -mindepth 1 -exec sh -c 'tar -zcf $(basename {}).tgz -C charts/ ./$(basename {})/' \; | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: charts | |
path: | | |
*.tgz | |
release-rolling: | |
needs: [test-helm-charts, create-artifact] | |
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: charts | |
- uses: "marvinpinto/[email protected]" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "rolling" | |
prerelease: true | |
title: "Cutting Edge" | |
files: | | |
trento-server.tgz | |
release: | |
runs-on: ubuntu-latest | |
needs: [test-helm-charts] | |
if: github.event.release | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Configure Git | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
- name: Set up Helm | |
uses: azure/[email protected] | |
with: | |
version: v3.7.2 | |
- name: Add dependency chart repos | |
run: | | |
helm repo add bitnami https://charts.bitnami.com/bitnami | |
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts | |
- name: Run chart-releaser | |
uses: helm/[email protected] | |
env: | |
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
CR_RELEASE_NAME_TEMPLATE: "{{ .Version }}" | |
obs-commit-charts: | |
needs: [test-helm-charts] | |
runs-on: ubuntu-20.04 | |
if: github.ref == 'refs/heads/main' || github.event_name == 'release' | |
container: | |
image: ghcr.io/trento-project/continuous-delivery:main | |
env: | |
DEST_FOLDER: "/tmp/osc_project" | |
FOLDER: packaging/suse | |
options: -u 0:0 | |
strategy: | |
matrix: | |
charts: ["trento-server"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions-ecosystem/action-get-latest-tag@v1 | |
id: latest-tag | |
with: | |
semver_only: true | |
initial_version: 0.0.1 | |
- name: Configure OSC | |
# OSC credentials must be configured beforehand as the HOME variables cannot be changed from /github/home | |
# that is used to run osc commands | |
run: | | |
mkdir -p $HOME/.config/osc | |
cp /home/osc/.config/osc/oscrc $HOME/.config/osc | |
/scripts/init_osc_creds.sh | |
- name: Prepare .changes file | |
# The .changes file is updated only in release creation. This current task should be improved | |
# in order to add the current rolling release notes | |
if: github.event_name == 'release' | |
run: | | |
PACKAGE_NAME=${{ matrix.charts }}-helm | |
CHANGES_FILE=${{ matrix.charts }}.changes | |
CHART_FOLDER=$FOLDER/${{ matrix.charts }} | |
osc checkout $OBS_PROJECT $PACKAGE_NAME $CHANGES_FILE | |
mv $CHANGES_FILE $CHART_FOLDER | |
TAG=${{ steps.latest-tag.outputs.tag }} | |
./hack/gh_release_to_obs_changeset.py ${{ github.repository }} -a [email protected] -t $TAG -f $CHART_FOLDER/$CHANGES_FILE | |
- name: Commit on OBS | |
run: | | |
echo "Commiting ${{ matrix.charts }} for package ${{ matrix.charts }}-helm" | |
OBS_PACKAGE=$OBS_PROJECT/${{ matrix.charts }}-helm | |
osc checkout $OBS_PACKAGE -o $DEST_FOLDER | |
cp -r packaging/suse/${{ matrix.charts }}/* $DEST_FOLDER | |
cp -r charts/${{ matrix.charts }}/Chart.yaml $DEST_FOLDER | |
cd $DEST_FOLDER | |
make | |
osc ar | |
osc commit -m "GitHub Actions automated update to reference ${{ github.sha }}" | |
obs-commit-scripts: | |
needs: [test-helm-charts] | |
runs-on: ubuntu-20.04 | |
if: github.ref == 'refs/heads/main' || github.event_name == 'release' | |
container: | |
image: ghcr.io/trento-project/continuous-delivery:main | |
env: | |
DEST_FOLDER: "/tmp/osc_project" | |
FOLDER: packaging/suse | |
options: -u 0:0 | |
strategy: | |
matrix: | |
packages: ["trento-server-installer"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions-ecosystem/action-get-latest-tag@v1 | |
id: latest-tag | |
with: | |
semver_only: true | |
initial_version: 0.0.1 | |
- name: Configure OSC | |
run: | | |
mkdir -p $HOME/.config/osc | |
cp /home/osc/.config/osc/oscrc $HOME/.config/osc | |
/scripts/init_osc_creds.sh | |
- name: Prepare _service file with version details | |
run: | | |
git config --global --add safe.directory /__w/helm-charts/helm-charts | |
VERSION=$(./hack/get_version_from_git.sh) | |
PACKAGE_FOLDER=$FOLDER/${{ matrix.packages }} | |
sed -i 's~%%REVISION%%~${{ github.sha }}~' $PACKAGE_FOLDER/_service && \ | |
sed -i 's~%%VERSION%%~'"${VERSION}"'~' $PACKAGE_FOLDER/_service | |
- name: Prepare OBS package | |
run: | | |
PACKAGE_FOLDER=$FOLDER/${{ matrix.packages }} | |
osc checkout $OBS_PROJECT ${{ matrix.packages }} -o $DEST_FOLDER | |
cp $PACKAGE_FOLDER/_service $DEST_FOLDER | |
cp $PACKAGE_FOLDER/${{ matrix.packages }}.spec $DEST_FOLDER | |
rm $DEST_FOLDER/*.tar.gz | |
pushd $DEST_FOLDER | |
osc service manualrun | |
- name: Prepare .changes file | |
if: github.event_name == 'release' | |
run: | | |
CHANGES_FILE=${{ matrix.packages }}.changes | |
TAG=${{ steps.latest-tag.outputs.tag }} | |
hack/gh_release_to_obs_changeset.py ${{ github.repository }} -a [email protected] -t $TAG -f $DEST_FOLDER/$CHANGES_FILE | |
- name: Commit on OBS | |
run: | | |
pushd $DEST_FOLDER | |
osc ar | |
osc commit -m "GitHub Actions automated update to reference ${{ github.sha }}" |