Skip to content

Commit

Permalink
Merge pull request #79 from bedroge/moving_latest_release
Browse files Browse the repository at this point in the history
Improve build and release CI
  • Loading branch information
boegel authored Mar 6, 2021
2 parents 023366d + 6225abc commit 2595a8c
Showing 1 changed file with 70 additions and 105 deletions.
175 changes: 70 additions & 105 deletions .github/workflows/build-test-release-client-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,54 +43,28 @@ jobs:
# it will make debugging more annoying.

- name: Build RPM package
id: build-rpm
uses: bpicode/github-action-fpm@master
with:
fpm_args: "etc"
fpm_opts: "--debug -n cvmfs-config-eessi -v ${{ steps.get_version.outputs.version }} -t rpm -a all -s dir -C ./package --description 'CVMFS configuration package for EESSI.'"

- name: Build Deb package
id: build-deb
uses: bpicode/github-action-fpm@master
with:
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 configuration package for EESSI.'"

- name: Build tar package
id: build-tar
uses: bpicode/github-action-fpm@master
with:
fpm_args: "etc"
fpm_opts: "--debug -n cvmfs-config-eessi-${{ steps.get_version.outputs.version }} -t tar -a all -s dir -C ./package --description 'CVMFS configuration package for EESSI.'"

- name: Find filenames of generated packages
id: find_filenames
shell: bash
run: |
rpmfile="$(ls -1 cvmfs-config-eessi*.rpm)"
debfile="$(ls -1 cvmfs-config-eessi*.deb)"
tarfile="$(ls -1 cvmfs-config-eessi*.tar)"
echo ::set-output name=rpmfile::${rpmfile}
echo ::set-output name=debfile::${debfile}
echo ::set-output name=tarfile::${tarfile}
- name: Upload Deb package as artifact
uses: actions/upload-artifact@v2
with:
name: Deb package
path: ${{ steps.find_filenames.outputs.debfile }}

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

- name: Upload tar package as artifact
- name: Upload packages as build artifacts
uses: actions/upload-artifact@v2
with:
name: Tar package
path: ${{ steps.find_filenames.outputs.tarfile }}
name: linux_packages
path: cvmfs-config-eessi*

build-macos-package:
runs-on: macos-latest
Expand Down Expand Up @@ -138,7 +112,7 @@ jobs:
- name: Upload macOS package as artifact
uses: actions/upload-artifact@v2
with:
name: macOS package
name: macos_package
path: ${{ steps.find_filename.outputs.pkgfile }}

test-deb-package:
Expand All @@ -157,13 +131,13 @@ jobs:
- name: Download cvmfs-config-eessi package
uses: actions/download-artifact@v2
with:
name: Deb package
name: linux_packages

- name: Find filename of package
id: find_filename
shell: bash
run: |
debfile="$(ls -1 cvmfs-config-eessi*.deb)"
debfile="$(find . -name cvmfs-config-eessi*.deb)"
echo ::set-output name=debfile::${debfile}
- name: Install package
Expand Down Expand Up @@ -195,13 +169,13 @@ jobs:
- name: Download cvmfs-config-eessi package
uses: actions/download-artifact@v2
with:
name: RPM package
name: linux_packages

- name: Find filename of package
id: find_filename
shell: bash
run: |
rpmfile="$(ls -1 cvmfs-config-eessi*.rpm)"
rpmfile="$(find . -name cvmfs-config-eessi*.rpm)"
echo ::set-output name=rpmfile::${rpmfile}
- name: Install package
Expand Down Expand Up @@ -233,13 +207,13 @@ jobs:
- name: Download cvmfs-config-eessi package
uses: actions/download-artifact@v2
with:
name: Tar package
name: linux_packages

- name: Find filename of package
id: find_filename
shell: bash
run: |
tarfile="$(ls -1 cvmfs-config-eessi*.tar)"
tarfile="$(find . -name cvmfs-config-eessi*.tar)"
echo ::set-output name=tarfile::${tarfile}
- name: Install package
Expand All @@ -259,21 +233,21 @@ jobs:
runs-on: macos-latest
steps:
- name: Install OSXFUSE
run: brew install --cask osxfuse
run: brew install --cask macfuse

- name: Download and install CVMFS client
run: wget https://ecsft.cern.ch/dist/cvmfs/cvmfs-2.7.5/cvmfs-2.7.5.pkg && sudo installer -target / -pkg cvmfs-2.7.5.pkg
run: wget https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-latest.pkg && sudo installer -target / -pkg cvmfs-latest.pkg

- name: Download cvmfs-config-eessi package
uses: actions/download-artifact@v2
with:
name: macOS package
name: macos_package

- name: Find filename of package
id: find_filename
shell: bash
run: |
pkgfile="$(ls -1 cvmfs-config-eessi*.pkg)"
pkgfile="$(find . -name cvmfs-config-eessi*.pkg)"
echo ::set-output name=pkgfile::${pkgfile}
- name: Install package
Expand All @@ -293,86 +267,77 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Download Deb package
uses: actions/download-artifact@v2
with:
name: Deb package

- name: Download RPM package
uses: actions/download-artifact@v2
with:
name: RPM package
- name: Checkout
uses: actions/checkout@v2

- name: Download tar package
uses: actions/download-artifact@v2
with:
name: Tar package
- name: Find release version in tag
id: find_version
run: |
echo ::set-output name=version::${GITHUB_REF#refs/tags/}
- name: Download macOS package
uses: actions/download-artifact@v2
- uses: actions/download-artifact@v2
with:
name: macOS package
path: ./build_artifacts

- name: Find filenames of downloaded packages
id: find_filenames
shell: bash
run: |
rpmfile="$(ls -1 cvmfs-config-eessi*.rpm)"
debfile="$(ls -1 cvmfs-config-eessi*.deb)"
pkgfile="$(ls -1 cvmfs-config-eessi*.pkg)"
tarfile="$(ls -1 cvmfs-config-eessi*.tar)"
echo ::set-output name=rpmfile::${rpmfile}
echo ::set-output name=debfile::${debfile}
echo ::set-output name=pkgfile::${pkgfile}
echo ::set-output name=tarfile::${tarfile}
ls -1 -R .
echo ::set-output name=package_filenames::$(find ./build_artifacts -name cvmfs-config-eessi*)
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: meeDamian/[email protected]
with:
tag_name: ${{ github.ref }}
release_name: Filesystem Layer ${{ github.ref }}
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.find_version.outputs.version }}
name: Filesystem Layer ${{ steps.find_version.outputs.version }}
body: >
Filesystem Layer release ${{ steps.find_version.outputs.version }}
files: ${{ steps.find_filenames.outputs.package_filenames }}
gzip: false

release-latest:
needs: [release] # only run when the previous step (the actual release) was successful
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Upload RPM as release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v2
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.find_filenames.outputs.rpmfile }}
asset_name: ${{ steps.find_filenames.outputs.rpmfile }}
asset_content_type: application/x-rpm
path: ./build_artifacts

- name: Upload Deb 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.debfile }}
asset_name: ${{ steps.find_filenames.outputs.debfile }}
asset_content_type: application/x-deb
- name: Find release version in tag
id: find_version
run: |
echo ::set-output name=version::${GITHUB_REF#refs/tags/}
- 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
- name: Find filenames of downloaded packages and rename them to latest
id: find_filenames
shell: bash
run: |
sudo apt-get install rename
rename "s/([0-9]+.[0-9]+.[0-9]+)(-[0-9]+)?/latest/g" $(find ./build_artifacts -name cvmfs-config-eessi*)
ls -1 -R ./build_artifacts
echo ::set-output name=package_filenames::$(find ./build_artifacts -name cvmfs-config-eessi*latest*)
- name: Upload Tar as release asset
uses: actions/upload-release-asset@v1
- name: Delete any previous tag/release named "latest"
uses: dev-drprasad/[email protected]
with:
delete_release: true # default: false
tag_name: latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: meeDamian/[email protected]
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.find_filenames.outputs.tarfile }}
asset_name: ${{ steps.find_filenames.outputs.tarfile }}
asset_content_type: application/x-tar
token: ${{ secrets.GITHUB_TOKEN }}
tag: latest
name: Filesystem Layer latest release
body: |
Filesystem Layer release ${{ steps.find_version.outputs.version }} (see: https://github.com/${{github.repository}}/releases/tag/${{ steps.find_version.outputs.version }})
This `latest` tag is a moving tag that is updated automatically for each release, and provides easy access to the latest `cvmfs-config-eessi` packages.
files: ${{ steps.find_filenames.outputs.package_filenames }}
gzip: false

0 comments on commit 2595a8c

Please sign in to comment.