From cbd216f6d9b6c5e21dbf2bba1d53f3af59483da2 Mon Sep 17 00:00:00 2001 From: treydock Date: Thu, 4 Nov 2021 11:48:18 -0400 Subject: [PATCH] Push ondemand tar.gz to release page on tags (#1564) * Push ondemand tar.gz to release page on tags Fixes #1546 * Just get release, don't try and create --- .github/workflows/release.yml | 43 +++++++++++++++++++++++++++++++++++ lib/tasks/packaging.rb | 4 ++-- packaging/rpm/ondemand.spec | 2 +- 3 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..c78e255fe5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,43 @@ +name: Release + +on: + push: + tags: + - '*' + +jobs: + release: + runs-on: ubuntu-latest + name: Release OnDemand + steps: + - name: Set version + id: version + run: echo ::set-output name=version::${GITHUB_REF#refs/*/v} + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Setup Ruby using Bundler + uses: ruby/setup-ruby@v1 + with: + ruby-version: "2.7.1" + bundler: "2.1.4" + bundler-cache: true + - name: Generate tar.gz + run: bundle exec rake package:tar + env: + VERSION: ${{ steps.version.outputs.version }} + - name: Get release + id: get_release + uses: bruceadams/get-release@v1.2.3 + env: + GITHUB_TOKEN: ${{ github.token }} + - name: Upload Release files + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.get_release.outputs.upload_url }} + asset_path: packaging/rpm/ondemand-${{ steps.version.outputs.version }}.tar.gz + asset_name: ondemand-${{ steps.version.outputs.version }}.tar.gz + asset_content_type: application/gzip diff --git a/lib/tasks/packaging.rb b/lib/tasks/packaging.rb index 937d4b2114..9f9febdb1b 100644 --- a/lib/tasks/packaging.rb +++ b/lib/tasks/packaging.rb @@ -39,14 +39,14 @@ def deb_build_cmd(packaging_dir, work_dir, output_dir, dist, version, extra_args dist = args[:dist] || 'el8' cmd = ['git', 'ls-files', '|', tar, '-c'] if dist =~ /^el/ + dir = File.join(proj_root, 'packaging/rpm') version = rpm_version - tar_file = "packaging/rpm/v#{version}.tar.gz" else dir = File.join(Dir.pwd, 'build').tap { |p| sh "mkdir -p #{p}" } version = deb_version - tar_file = "#{dir}/#{ood_package_name}-#{version}.tar.gz" cmd.concat ["--transform 'flags=r;s,packaging/deb,debian,'"] end + tar_file = "#{dir}/#{ood_package_name}-#{version}.tar.gz" cmd.concat ["--transform 's,^,#{ood_package_name}-#{version}/,'"] cmd.concat ['-T', '-', '|', "gzip > #{tar_file}"] diff --git a/packaging/rpm/ondemand.spec b/packaging/rpm/ondemand.spec index 0cf91c7164..ebb417e9d3 100644 --- a/packaging/rpm/ondemand.spec +++ b/packaging/rpm/ondemand.spec @@ -24,7 +24,7 @@ Summary: Web server that provides users access to HPC resources Group: System Environment/Daemons License: MIT URL: https://osc.github.io/Open-OnDemand -Source0: https://github.com/OSC/%{package_name}/archive/%{git_tag}.tar.gz +Source0: https://github.com/OSC/%{package_name}/releases/download/%{git_tag}/%{package_name}-%{git_tag_minus_v}.tar.gz Source1: ondemand-selinux.te Source2: ondemand-selinux.fc