Skip to content

Commit

Permalink
Move release deployment script from Travis to GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
rvl committed Apr 29, 2021
1 parent 22e6b0b commit 442d31b
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 108 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: release

on:
push:
branches:
- rvl/release-scripts
- master
tags:
- 'v*'

jobs:
release:
if: ${{ github.ref == 'refs/heads/rvl/release-scripts' || startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-20.04
steps:
- name: '❄ Wait for Hydra build'
uses: rvl/hydra-build-products-action@master
id: hydra
with:
hydra: 'https://hydra.iohk.io'
jobs: 'cardano-wallet-linux64 cardano-wallet-macos64 cardano-wallet-win64'

- name: '🍒 Fetch release files'
run: |
for url in ${{ steps.hydra.outputs.buildProducts }}; do
wget $url
done
- name: '🚀 Release'
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: docker://antonyurchenko/git-release:v3.4.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRAFT_RELEASE: "true"
PRE_RELEASE: "false"
# CHANGELOG_FILE: "ChangeLog.md"
# ALLOW_EMPTY_CHANGELOG: "false"
ALLOW_TAG_PREFIX: "true"
with:
args: '*.tar.gz *.zip'

docs:
runs-on: ubuntu-20.04
steps:
- name: '📥 Checkout repository'
uses: actions/checkout@v1

- name: '📸 Build Documentation'
run: |
if [[ $GITHUB_REF =~ ^refs/tags/v ]]; then
tag="${GITHUB_REF/refs\/tags\//}"
else
tag=""
fi
./scripts/update-docs.sh _build $tag
- name: '📘 Publish'
if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.WILLIAM_KING_TOKEN }}
enable_jekyll: false
publish_dir: _build
keep_files: true

bump_sh:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-20.04
steps:
- name: '📥 Checkout repository'
uses: actions/checkout@v1
- name: 'Set up Ruby'
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: 'Install gems'
run: 'gem install bump-cli'
- name: 'Install dependencies'
run: 'sudo snap install yq'
- name: 'Update Release in Bump.sh'
run: './scripts/update-bump.sh'
env:
BUMP_SH_DOC_ID: ${{ secrets.BUMP_SH_DOC_ID }}
BUMP_SH_TOKEN: ${{ secrets.BUMP_SH_TOKEN }}
108 changes: 0 additions & 108 deletions .travis.yml

This file was deleted.

18 changes: 18 additions & 0 deletions scripts/update-bump.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Needs yq version 4 and the bump-cli ruby gem

set -euo pipefail

if [ -z "${BUMP_SH_DOC_ID:-}" ] || [ -z "${BUMP_SH_TOKEN:-}" ]; then
echo "BUMP_SH_DOC_ID or BUMP_SH_TOKEN variables not set" > /dev/stderr
exit 1
fi

bump_swagger() {
bump "$1" --doc "$BUMP_SH_DOC_ID" --token "$BUMP_SH_TOKEN" specifications/api/swagger.json
}

yq eval specifications/api/swagger.yaml -j > specifications/api/swagger.json

bump_swagger validate
bump_swagger deploy
24 changes: 24 additions & 0 deletions scripts/update-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

set -euo pipefail

root=$(cd "$(dirname "$0")"/..; pwd)
out="${1:-}"
tag="${2:-}"

if [ -z "$out" ]; then
echo "usage: $0 DEST_DIR [TAG]"
exit 1
fi

if [ -n "$tag" ]; then
what="release tag $tag"
dest="$out/api/$tag"
else
what="git snapshot"
dest="$out/api/edge"
fi

echo '*** Building documentation for' "$what"
mkdir -p "$dest"
cp -Rv "$root"/specifications/api/* "$dest"

0 comments on commit 442d31b

Please sign in to comment.