-
Notifications
You must be signed in to change notification settings - Fork 20
69 lines (67 loc) · 2.84 KB
/
ibmi_release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: IBM i build new release
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
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/ ./rpmbuild/RPMS/
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
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Get version from tag
id: get_version
run: |
echo VERSION=${GITHUB_REF#refs/tags/v} >> $GITHUB_OUTPUT
- 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: Generate the RPM spec file
run: |
python3 tools/release/generate_spec.py ${{ steps.get_version.outputs.VERSION }} CHANGELOG True
- name: Create rpmbuild directory
run: |
mkdir -p rpmbuild/{BUILD,RPMS,SOURCES,SPECS,BUILDROOT}
cp bob.spec rpmbuild/SPECS
- 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 RPM build
id: remote_build
run: |
$ssh_command "cd $remote_build_dir && PATH=/QOpenSys/pkgs/bin:/QOpenSys/usr/bin:/usr/bin time /QOpenSys/pkgs/bin/rpmbuild -ba --define '_topdir $remote_build_dir/rpmbuild' rpmbuild/SPECS/bob.spec"
- name: Find RPM file
id: find_rpm
run: |
$scp_dist_command
echo "RPM_FILE_PATH=$(find . -name '*.rpm' -print -quit)" >> $GITHUB_OUTPUT
- name: Cleanup remote build dir
if: always()
run: $ssh_command "rm -fr $remote_build_dir"
- name: Rename RPM before attaching
run: mv ${{ steps.find_rpm.outputs.RPM_FILE_PATH }} bob.rpm
- name: Create the tag and release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref }}
name: Release ${{ steps.get_version.outputs.VERSION }}
files: bob.rpm