Skip to content

Commit

Permalink
workflows: more workflow automation
Browse files Browse the repository at this point in the history
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
  • Loading branch information
hdonnay committed Mar 27, 2020
1 parent fe324a5 commit cec05a3
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 8 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/cut-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,12 @@ on:
name: Upload Release Assets

jobs:
checkout:
name: Checkout Code
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
build:
name: Upload Release Assets
runs-on: ubuntu-latest
needs: checkout
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Prepare Environment
run: |
: "${tag:=${GITHUB_REF#refs/tags/}}"
Expand Down Expand Up @@ -58,8 +53,9 @@ jobs:
deploy-documentation:
name: Deploy Documentation
runs-on: ubuntu-latest
needs: checkout
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup
uses: peaceiris/actions-mdbook@v1
with:
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: CI

on:
push:
branches:
- master
- development-4.0 # Remove this when the branch switch happens.
pull_request:
branches:
- master
- development-4.0 # Remove this when the branch switch happens.

jobs:
documentation:
name: Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: 'latest'
- run: mdbook build
tests:
name: Tests
runs-on: ubuntu-latest
container: docker.io/library/golang:1.14-alpine
steps:
- name: Checkout
uses: actions/checkout@v2
- name: OS Dependencies
run: apk add --no-cache tar rpm build-base
- name: Go Dependencies
run: go mod vendor
- name: Tests
run: go test ./...
65 changes: 65 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
name: Prepare Release

on:
push:
tags:
- 'v4.*'

jobs:
create:
name: Create Release
runs-on: 'ubuntu-latest'
steps:
- name: Setup
run: |
: "${tag:=${GITHUB_REF#refs/tags/}}"
cat <<.
::set-env name=CLAIR_VERSION::${tag}
.
- name: Create Release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ env.CLAIR_VERSION}} Release
body: |
Coming Soon...
draft: true
prerelease: ${{ contains(env.CLAIR_VERSION, 'alpha') || contains(env.CLAIR_VERSION, 'beta') || contains(env.CLAIR_VERSION, 'rc') }}
stable:
if: endsWith(github.ref, '.0')
name: Create Stable Helpers
runs-on: 'ubuntu-latest'
steps:
- name: Create Branch
uses: actions/github-script@0.9.0
with:
script: |
const tag = context.ref.replace("refs/tags/", "");
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/heads/release-' + tag,
sha: context.sha
});
- name: Create Labels
uses: actions/github-script@0.9.0
with:
script: |
const tag = context.ref.replace("refs/tags/", "").slice(0, -2);
github.issues.createLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: 'NeedsBackport-' + tag,
color: '790604',
description: `This needs to be backported to ${tag}`
});
github.issues.createLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: 'PossibleBackport-' + tag,
color: '008000',
description: `This may need to be backported to ${tag}`
});

0 comments on commit cec05a3

Please sign in to comment.