Skip to content

Commit

Permalink
Add OBS commit step in pipeline
Browse files Browse the repository at this point in the history
Co-authored-by: rtorrero <[email protected]>
  • Loading branch information
nelsonkopliku and rtorrero committed Jan 20, 2023
1 parent 12fe492 commit 9d21142
Showing 1 changed file with 89 additions and 3 deletions.
92 changes: 89 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ jobs:
name: Elixir dependencies
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -70,6 +74,10 @@ jobs:
needs: elixir-deps
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3
with:
Expand All @@ -91,7 +99,7 @@ jobs:
_build/test
priv/plts
key: ${{ runner.os }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('mix.lock') }}
- name: Check for Unused Dependencies
- name: Check for unused dependencies
run: mix deps.unlock --check-unused
- name: Check Code Format
run: mix format --check-formatted
Expand Down Expand Up @@ -126,6 +134,10 @@ jobs:
ports:
- 5674:5672
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -167,14 +179,14 @@ jobs:
fetch-depth: 0
- uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a
uses: docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96
with:
images: ${{ env.IMAGE_REPOSITORY }}
- name: Build and push container image
Expand Down Expand Up @@ -221,3 +233,77 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc

obs-commit:
name: Commit the project on OBS
runs-on: ubuntu-latest
if: github.event_name == 'release' || (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch'
needs: [static-code-analysis, test]
container:
image: ghcr.io/trento-project/continuous-delivery:main
env:
GITHUB_OAUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEST_FOLDER: "/tmp/osc_project"
NAME: trento-wanda-image
OBS_USER: ${{ secrets.OBS_USER }}
OBS_PASS: ${{ secrets.OBS_PASS }}
OBS_PROJECT: ${{ secrets.OBS_PROJECT }}
FOLDER: packaging/suse
REPOSITORY: ${{ github.repository }}
options: -u 0:0
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3
- uses: actions-ecosystem/action-get-latest-tag@v1
id: latest-tag
with:
semver_only: true
initial_version: 0.0.1
- name: Setup rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.66
- name: Get mix deps
run: mix local.hex --force && mix local.rebar --force && mix deps.clean --all && mix deps.get
- name: cargo vendor
run: |
cd deps/rhai_rustler/native/rhai_rustler
cargo vendor
printf '\n\n[source.crates-io]\nreplace-with = "vendored-sources"\n\n[source.vendored-sources]\ndirectory = "vendor"\n' >> .cargo/config
- 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: |
CHANGES_FILE=$NAME.changes
osc checkout $OBS_PROJECT $NAME $CHANGES_FILE
mv $CHANGES_FILE $FOLDER
VERSION=${{ steps.latest-tag.outputs.tag }}
hack/gh_release_to_obs_changeset.py $REPOSITORY -a [email protected] -t $VERSION -f $FOLDER/$CHANGES_FILE
- name: Set version
run: |
git config --global --add safe.directory /__w/wanda/wanda
VERSION=$(./hack/get_version_from_git.sh)
# "+" character is not allowed in OBS dockerfile version strings
VERSION=${VERSION//[+]/-}
sed -i 's~%%VERSION%%~'"${VERSION}"'~' packaging/suse/Dockerfile
- name: Commit on OBS
run: |
OBS_PACKAGE=$OBS_PROJECT/$NAME
osc checkout $OBS_PACKAGE -o $DEST_FOLDER
cp -r packaging/suse/* $DEST_FOLDER
tar --transform 's,^./,/wanda/,' -zcvf $DEST_FOLDER/wanda.tar.gz --exclude=./.git ./*
cd $DEST_FOLDER
osc ar
osc commit -m "New development version of $NAME released"

0 comments on commit 9d21142

Please sign in to comment.