File tree Expand file tree Collapse file tree 3 files changed +67
-4
lines changed Expand file tree Collapse file tree 3 files changed +67
-4
lines changed Original file line number Diff line number Diff line change 1- FROM rust:alpine
2-
3- RUN curl -LSfs https://japaric.github.io/trust/install.sh | sh -s -- --git cobalt-org/cobalt.rs --crate cobalt
1+ FROM lehmannka/cobalt.rs
42
3+ RUN apt update && apt install -y git
54COPY ./entrypoint.sh /entrypoint.sh
65
6+ WORKDIR /src/
7+
78ENTRYPOINT [ "/entrypoint.sh" ]
Original file line number Diff line number Diff line change @@ -11,4 +11,13 @@ inputs:
1111 githubToken :
1212 description : " Personal Access Token with permission to the repository"
1313 required : true
14-
14+ repo :
15+ description : " Repository to push building page"
16+ required : false
17+ branch :
18+ description : " Branch to push building page"
19+ required : false
20+ default : " gh-pages"
21+ cname :
22+ description : " Registry dns name to page"
23+ required : false
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env sh
2+
3+ set -e
4+
5+ NC=' \e[0m'
6+ BOLD=' \e[1m'
7+ UNDERLINE=' \e[4m'
8+ BRED=' \e[1;4;31m'
9+ IRED=' \e[3;31m'
10+ BGREEN=' \e[1;32m'
11+
12+
13+ if [ -z " ${INPUT_GITHUBTOKEN} " ]; then
14+ echo -e " ${BRED} Error:\n${NC} ${IRED} Missing Github Access Token${NC} "
15+ exit 1
16+ fi
17+
18+ if [ " ${INPUT_REPO} " ]; then
19+ REPO=${INPUT_REPO}
20+ else
21+ REPO=${GITHUB_REPOSITORY}
22+ fi
23+
24+ REPO_URL=" https://x-access-token:${INPUT_GITHUBTOKEN} @github.com/${REPO} .git"
25+
26+ echo -e " ${UNDERLINE} Resume${NC} "
27+ echo -e " ${BOLD} REPO:${NC} ${REPO} "
28+ echo -e " ${BOLD} BRANCH:${NC} ${INPUT_BRANCH} "
29+ [ -n " ${INPUT_CNAME} " ] && echo -e " ${BOLD} CNAME:${NC} ${INPUT_CNAME} "
30+
31+ echo -e " \n${BOLD} Setting up Git${NC} ..."
32+ git config --global user.name " ${GITHUB_ACTOR} "
33+ git config --global user.email " ${GITHUB_ACTOR} @users.noreply.github.com"
34+ echo " machine github.com login ${GITHUB_ACTOR} password ${INPUT_GITHUBTOKEN} " > ~ /.netrc
35+
36+ echo -e " \nBuilding.."
37+ git clone --depth=1 --single-branch --branch " ${INPUT_BRANCH} " " ${REPO_URL} " /tmp/build
38+
39+ rm -rf /tmp/build/*
40+
41+ cobalt build
42+
43+ cp -a build/* /tmp/build
44+
45+ cd /tmp/build
46+
47+ [ -n " ${INPUT_CNAME} " ] && echo " ${INPUT_CNAME} " > CNAME
48+ echo -e " \b${BGREEN} [OK]${NC} "
49+
50+ echo -e " \n\nPuching..."
51+ git add -A && git commit --allow-empty -am " Publishing site at $( date -u) "
52+ git push --force
53+ echo -e " \b${BGREEN} [OK]${NC} "
You can’t perform that action at this time.
0 commit comments