Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v3] Prepare for v3 #117

Merged
merged 20 commits into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4eab265
Add docs/reference split
ErikSchierboom Feb 26, 2020
6bd5d62
[v3] Move existing exercises to exercises/practice
ErikSchierboom Jan 29, 2021
a30bf81
[v3] Add version property to config.json
ErikSchierboom Jan 29, 2021
e9b162d
[v3] Add status to config.json
ErikSchierboom Jan 29, 2021
7643023
[v3] Add slug to config.json
ErikSchierboom Jan 29, 2021
63a976f
[v3] Add online_editor property to config.json
ErikSchierboom Jan 29, 2021
65aec46
[v3] Re-order practice exercises in config.json
ErikSchierboom Jan 29, 2021
35ea39d
[v3] Remove deprecated properties from practice exercises in config.json
ErikSchierboom Jan 29, 2021
89ff353
[v3] Add name property to practice exercises in config.json
ErikSchierboom Jan 29, 2021
fa2631a
[v3] Add (empty) prerequisites property to practice exercises in conf…
ErikSchierboom Jan 29, 2021
5f96dd6
[v3] Move exercises to practice exercises property in config.json
ErikSchierboom Jan 29, 2021
ad40049
[v3] Add concept exercises to config.json
ErikSchierboom Jan 29, 2021
5fd5747
[v3] Add concepts to config.json
ErikSchierboom Jan 29, 2021
29b6633
[v3] Add key features to config.json
ErikSchierboom Jan 29, 2021
dbc31e6
[v3] Add tags to config.json
ErikSchierboom Jan 29, 2021
9003d8d
[v3] Add configlet CI workflow
ErikSchierboom Jan 29, 2021
063fd26
[v3] Update fetch-configlet script to work with configlet v3
ErikSchierboom Jan 29, 2021
26a141e
[v3] Add dependabot to keep GHA dependencies up-to-date
ErikSchierboom Jan 29, 2021
5007307
[v3] Convert relative v3 links to absolute links
ErikSchierboom Jan 29, 2021
29d0eec
[v3] Fix configlet CI workflow
ErikSchierboom Jan 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2

updates:

# Keep dependencies for GitHub Actions up-to-date
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'daily'
16 changes: 16 additions & 0 deletions .github/workflows/configlet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Configlet CI

on: [push, pull_request, workflow_dispatch]

jobs:
configlet:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f

- name: Fetch configlet
uses: exercism/github-actions/configlet-ci@main

- name: Configlet Linter
run: configlet lint
70 changes: 38 additions & 32 deletions bin/fetch-configlet
Original file line number Diff line number Diff line change
@@ -1,52 +1,58 @@
#!/bin/bash
#!/usr/bin/env bash

set -eo pipefail

readonly LATEST='https://api.github.com/repos/exercism/configlet/releases/latest'

case "$(uname)" in
(Darwin*) OS='mac' ;;
(Linux*) OS='linux' ;;
(Windows*) OS='windows' ;;
(MINGW*) OS='windows' ;;
(MSYS_NT-*) OS='windows' ;;
(*) OS='linux' ;;
Darwin*) os='mac' ;;
Linux*) os='linux' ;;
Windows*) os='windows' ;;
MINGW*) os='windows' ;;
MSYS_NT-*) os='windows' ;;
*) os='linux' ;;
esac

case "$OS" in
(windows*) EXT='zip' ;;
(*) EXT='tgz' ;;
case "${os}" in
windows*) ext='zip' ;;
*) ext='tgz' ;;
esac

case "$(uname -m)" in
(*64*) ARCH='64bit' ;;
(*686*) ARCH='32bit' ;;
(*386*) ARCH='32bit' ;;
(*) ARCH='64bit' ;;
*64*) arch='64bit' ;;
*686*) arch='32bit' ;;
*386*) arch='32bit' ;;
*) arch='64bit' ;;
esac

if [ -z "${GITHUB_TOKEN}" ]
then
HEADER=''
else
HEADER="authorization: Bearer ${GITHUB_TOKEN}"
curlopts=(
--silent
--show-error
--fail
--location
--retry 3
)

if [[ -n "${GITHUB_TOKEN}" ]]; then
curlopts+=(--header "authorization: Bearer ${GITHUB_TOKEN}")
fi

FILENAME="configlet-${OS}-${ARCH}.${EXT}"
suffix="${os}-${arch}.${ext}"

get_url () {
curl --header "$HEADER" -s "$LATEST" |
awk -v filename=$FILENAME '$1 ~ /browser_download_url/ && $2 ~ filename { print $2 }' |
tr -d '"'
get_download_url() {
curl "${curlopts[@]}" --header 'Accept: application/vnd.github.v3+json' "${LATEST}" |
grep "\"browser_download_url\": \".*/download/.*/configlet.*${suffix}\"$" |
cut -d'"' -f4
}

URL=$(get_url)
download_url="$(get_download_url)"
output_dir="bin"
output_path="${output_dir}/latest-configlet.${ext}"
curl "${curlopts[@]}" --output "${output_path}" "${download_url}"

case "$EXT" in
(*zip)
curl --header "$HEADER" -s --location "$URL" -o bin/latest-configlet.zip
unzip bin/latest-configlet.zip -d bin/
rm bin/latest-configlet.zip
;;
(*) curl --header "$HEADER" -s --location "$URL" | tar xz -C bin/ ;;
case "${ext}" in
*zip) unzip "${output_path}" -d "${output_dir}" ;;
*) tar xzf "${output_path}" -C "${output_dir}" ;;
esac

rm -f "${output_path}"
Loading