Skip to content

Commit 0496833

Browse files
author
Johannes Wünsche
committed
Try out github workflows
1 parent 71d8bda commit 0496833

File tree

3 files changed

+42
-29
lines changed

3 files changed

+42
-29
lines changed

.github/workflows/test_and_push.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "test_and_badge"
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
9+
jobs:
10+
test_and_badge:
11+
name: "Test and Badge"
12+
runs-on: "ubuntu-latest"
13+
steps:
14+
- name: "Prepare"
15+
run: |
16+
sudo apt-get update
17+
sudo apt-get install -y curl git
18+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
19+
source $HOME/.cargo/env
20+
rustup toolchain install nightly
21+
git clone https://github.com/deinstapel/cursive-multiplex.git
22+
23+
- name: "Build and Test"
24+
run: |
25+
cd cursive-multiplex
26+
RUST_CHAIN=stable ./scripts/ci-build.sh
27+
RUST_CHAIN=nightly ./scripts/ci-build.sh
28+
29+
- name: "Deploy Badge"
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: |
33+
cd cursive-multiplex
34+
./scripts/deploy-badges.sh

.travis.yml

-23
This file was deleted.

scripts/deploy-badges.sh

+8-6
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,28 @@ die() {
55
exit 1
66
}
77

8-
if [ -z "$GITHUB_USERNAME" ]
8+
if [ -z "$GITHUB_ACTOR" ]
99
then
10-
die "the GITHUB_USERNAME environment variable is not set"
10+
die "the GITHUB_ACTOR environment variable is not set"
1111
fi
1212

1313
if [ -z "$GITHUB_TOKEN" ]
1414
then
1515
die "the GITHUB_TOKEN environment variable is not set"
1616
fi
1717

18-
if [ -z "$GITHUB_REPO_SLUG" ]
18+
if [ -z "$GITHUB_REPOSITORY" ]
1919
then
20-
die "the GITHUB_REPO_SLUG environment variable is not set"
20+
die "the GITHUB_REPOSITORY environment variable is not set"
2121
fi
2222

2323
(
2424
cd "$(git rev-parse --show-toplevel)/target/shields" || die "cannot find project root!"
25-
repo="https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/${GITHUB_REPO_SLUG}.git"
25+
repo="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
2626
tmp_dir=$(mktemp -d -t cursive-multiplex-deploy-XXXXXXXX)
2727

28+
git config --global user.email "runner@ci"
29+
git config --global user.name "Github CI Runner"
2830
try=0
2931
while :; do
3032
if ! git clone --branch gh-pages "$repo" "$tmp_dir"
@@ -42,7 +44,7 @@ fi
4244
(
4345
cd "$tmp_dir" || die "failed to enter temporary directory"
4446
git add -A
45-
git commit -m "Travis CI badge deployment"
47+
git commit -m "Github CI badge deployment"
4648
git push origin gh-pages:gh-pages
4749
)
4850

0 commit comments

Comments
 (0)