Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add package creation for MacOS #54

Closed
wants to merge 3 commits into from
Closed
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
82 changes: 75 additions & 7 deletions .github/workflows/build-client-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@ on:
push:
branches:
- master
- build_packages
tags:
- 'v*'
pull_request:
branches:
- master
- build_packages

jobs:

build-packages:
build-linux-packages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2

- name: Get the version number for the packages
id: get_version
Expand All @@ -40,6 +39,9 @@ jobs:
targets: "./prepare-client-packages.yml"
hosts: "localhost"

# We probably should loop over the set {rpm,deb,osxpkg} to create packages, but
# it will make debugging more annoying.

- name: Build RPM package
id: build-rpm
uses: bpicode/github-action-fpm@master
Expand All @@ -54,7 +56,7 @@ jobs:
fpm_args: "etc"
fpm_opts: "--debug -n cvmfs-config-eessi -v ${{ steps.get_version.outputs.version }} -t deb -a all -s dir -C ./package --description 'CVMFS config repository package for EESSI.'"

- name: Find filenames of downloaded packages
- name: Find filenames of generated packages
id: find_filenames
shell: bash
run: |
Expand All @@ -75,8 +77,57 @@ jobs:
name: RPM package
path: ${{ steps.find_filenames.outputs.rpmfile }}

build-osx-package:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Get the version number for the packages
id: get_version
# If this is a tag, use the tag name (e.g. v1.2.3) without v as version number.
# Otherwise, just use 0.0.
run: |
VERSION=0.0
REF_NAME=${{ github.ref }}
[[ $REF_NAME == refs/tags/v* ]] && VERSION=${REF_NAME/refs\/tags\/v/}
echo ::set-output name=version::${VERSION}

# The next step uses a custom Ansible inventory, and due to that it cannot find
# the group_vars folder inside the inventory folder. This symlink fixes that.
- name: Make symlink to group_vars
run: ln -s inventory/group_vars

- name: Install Ansible
run: pip3 install ansible

- name: Prepare package source
run: ansible-playbook --connection=local ./prepare-client-packages.yml

- name: Install dependencies
run: brew install gnu-tar

- name: Install fpm
run: gem install --no-document fpm

- name: Build package
run: "fpm --debug -n cvmfs-config-eessi -v ${{ steps.get_version.outputs.version }} -t osxpkg -a all -s dir -C ./package --description 'CVMFS config repository package for EESSI.' etc"

- name: Find filename of generated package
id: find_filenames
shell: bash
run: |
pkgfile="$(ls -1 *.pkg)"
echo ::set-output name=pkgfile::${pkgfile}

- name: Upload macOS package as artifact
uses: actions/upload-artifact@v2
with:
name: macOS package
path: ${{ steps.find_filenames.outputs.pkgfile }}

release:
needs: build-packages
needs: [build-linux-packages, build-osx-package]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
Expand All @@ -90,14 +141,21 @@ jobs:
with:
name: RPM package

- name: Download macOS package
uses: actions/download-artifact@v2
with:
name: macOS package

- name: Find filenames of downloaded packages
id: find_filenames
shell: bash
run: |
rpmfile="$(ls -1 *.rpm)"
debfile="$(ls -1 *.deb)"
pkgfile="$(ls -1 *.pkg)"
echo ::set-output name=rpmfile::${rpmfile}
echo ::set-output name=debfile::${debfile}
echo ::set-output name=pkgfile::${pkgfile}

- name: Create Release
id: create_release
Expand Down Expand Up @@ -128,4 +186,14 @@ jobs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.find_filenames.outputs.debfile }}
asset_name: ${{ steps.find_filenames.outputs.debfile }}
asset_content_type: application/x-debian-package
asset_content_type: application/x-deb

- name: Upload Pkg as release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.find_filenames.outputs.pkgfile }}
asset_name: ${{ steps.find_filenames.outputs.pkgfile }}
asset_content_type: application/x-newton-compatible-pkg