Skip to content
This repository was archived by the owner on Dec 21, 2021. It is now read-only.

Adds a conditional action to build and push rpm and apt artifacts for pull requests to the dev repositories in nexus. #169

Merged
merged 3 commits into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/build_artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Publish-Artifacts

on:
push:
branches:
- main
pull_request:

env:
CARGO_TERM_COLOR: always
REPO_APT_DEV_URL: https://repo.stackable.tech/repository/deb-dev
REPO_RPM_DEV_URL: https://repo.stackable.tech/repository/rpm-dev

jobs:
debian10:
runs-on: debian10
steps:
- uses: actions/checkout@v2
- name: Change version if is PR
if: ${{ github.event_name == 'pull_request' }}
# We use "mr" instead of "pr" to denote pull request builds, as this prefix comes before "nightly" when lexically
# sorting packages by version. This means that when installing the package without specifying a version the
# nighly version is considered more current than mr versions and installed by default
run: sed -i -e 's/^version = "\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/version = "\1-mr${{ github.event.number }}"/' Cargo.toml
- name: Build
run: ~/.cargo/bin/cargo +nightly build --verbose --release
- name: Build apt package
run: ~/.cargo/bin/cargo deb --manifest-path Cargo.toml --no-build
- name: Check workflow permissions
id: check_permissions
uses: scherermichael-oss/action-has-permission@1.0.6
with:
required-permission: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish apt package
if: steps.check_permissions.outputs.has-permission
run: >-
/usr/bin/curl
--fail
-u 'github:${{ secrets.NEXUS_PASSWORD }}'
-H "Content-Type: multipart/form-data"
--data-binary "@./$(find target/debian/ -name *.deb)"
"${{ env.REPO_APT_DEV_URL }}/"
- name: Clean
run: ~/.cargo/bin/cargo clean

centos:
runs-on: centos${{ matrix.node }}
strategy:
matrix:
node: [ 7, 8 ]
steps:
- uses: actions/checkout@v2
- name: Change version if is PR
if: ${{ github.event_name == 'pull_request' }}
# We use "mr" instead of "pr" to denote pull request builds, as this prefix comes before "nightly" when lexically
# sorting packages by version. This means that when installing the package without specifying a version the
# nighly version is considered more current than mr versions and installed by default
run: sed -i -e 's/^version = "\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/version = "\1-pr${{ github.event.number }}"/' Cargo.toml
- name: Build
run: ~/.cargo/bin/cargo +nightly build --verbose --release
- name: Build RPM package
run: packaging/buildrpm.sh stackable-agent
- name: Check workflow permissions
id: check_permissions
uses: scherermichael-oss/action-has-permission@1.0.6
with:
required-permission: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish RPM package
if: steps.check_permissions.outputs.has-permission
run: >-
/usr/bin/curl
--fail
-u 'github:${{ secrets.NEXUS_PASSWORD }}'
--upload-file "./$(find target/rpm/RPMS/x86_64/ -name *.rpm)"
"${{ env.REPO_RPM_DEV_URL }}/el${{ matrix.node }}/"
46 changes: 0 additions & 46 deletions .github/workflows/nightly.yml

This file was deleted.