Create release-tarball.yml

This commit is contained in:
Rob Loach 2020-03-14 11:48:45 -04:00 committed by GitHub
parent b3a479b700
commit 66ac00b890
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

57
.github/workflows/release-tarball.yml vendored Normal file
View File

@ -0,0 +1,57 @@
# This is a basic workflow to help you get started with Actions
name: Create Release
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check out the source
uses: actions/checkout@v2
with:
submodules: true
- name: Set release tarball name
run: echo ::set-env name=TARBALL_NAME::$(echo cp2k-${GITHUB_REF##*/v}.tar.bz2)
- name: Install prerequisites
run: |
pip install git-archive-all
- name: Build release tarball
run: |
mkdir -p dist/
~/.local/bin/git-archive-all ./dist/${TARBALL_NAME}
- name: Create Release Draft
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: ChaiLove ${{ github.ref }}
draft: true
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./dist/${{ env.TARBALL_NAME }}
asset_name: ${{ env.TARBALL_NAME }}
asset_content_type: application/x-gtar