Update service-commander.spec #232
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: IBM i CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request_target: | |
types: [assigned, opened, synchronize, reopened, edited, ready_for_review] | |
env: | |
ssh_command: ssh ${{ secrets.IBMI_BUILD_USRPRF }}@${{ secrets.IBMI_BUILD_SYS }} | |
scp_dist_command: scp -r ${{ secrets.IBMI_BUILD_USRPRF }}@${{ secrets.IBMI_BUILD_SYS }}:/home/${{ secrets.IBMI_BUILD_USRPRF }}/build/${{ github.sha }}/rpmbuild/RPMS/ppc64/ . | |
remote_build_dir: /home/${{ secrets.IBMI_BUILD_USRPRF }}/build/${{ github.sha }} | |
rsync_command: rsync -a --exclude='.*' --exclude='runners' --rsync-path=/QOpenSys/pkgs/bin/rsync ./ ${{ secrets.IBMI_BUILD_USRPRF }}@${{ secrets.IBMI_BUILD_SYS }}:/home/${{ secrets.IBMI_BUILD_USRPRF }}/build/${{ github.sha }}/ | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install private key | |
run: | | |
mkdir -p ~/.ssh | |
chmod 0755 ~ | |
chmod 0700 ~/.ssh | |
echo "${{ secrets.IBMI_BUILD_PVTKEY }}" > ~/.ssh/id_rsa | |
chmod 0600 ~/.ssh/id_rsa | |
- name: Disable strict host key checking | |
run: | | |
echo "Host *" > ~/.ssh/config | |
echo " StrictHostKeyChecking no" >> ~/.ssh/config | |
- name: Create build sandbox | |
run: $ssh_command "mkdir -p $remote_build_dir" | |
- name: Populate build sandbox | |
run: $rsync_command | |
- name: Get short SHA ID | |
run: | | |
echo "short_sha=$(echo ${{ github.sha }} | head -c 7)" >> $GITHUB_ENV | |
cat $GITHUB_ENV | |
- name: Perform remote build | |
run: $ssh_command "cd $remote_build_dir && mkdir -p ./rpmbuild && PATH=/QOpenSys/pkgs/bin:/QOpenSys/usr/bin:/usr/bin time /QOpenSys/pkgs/bin/rpmbuild -bb --build-in-place --define '_topdir $remote_build_dir/rpmbuild' --define '_disable_source_fetch 1' service-commander.spec" | |
- name: list RPMs | |
run: $ssh_command "find $remote_build_dir -name \*.rpm" | |
- name: Retrieve artifact | |
run: $scp_dist_command | |
- name: Cleanup remote build dir | |
if: always() | |
run: $ssh_command "rm -fr $remote_build_dir" |