Compare commits

..

2 Commits

Author SHA1 Message Date
peaceiris
1c67c4654b feat: update alpine to 3.11.0
cf. #64
2019-12-23 12:15:08 +09:00
peaceiris
cbdb69fd85 feat: ignore .git and .github
Close #57
2019-12-23 06:44:37 +09:00
8 changed files with 9 additions and 210 deletions

View File

@@ -2,7 +2,7 @@ version: 1
update_configs: update_configs:
- package_manager: "docker" - package_manager: "docker"
directory: "/" directory: "/"
update_schedule: "daily" update_schedule: "weekly"
default_labels: default_labels:
- "dependencies" - "dependencies"
- "docker" - "docker"

1
.gitignore vendored
View File

@@ -1 +0,0 @@
.DS_Store

View File

@@ -1,4 +1,4 @@
FROM alpine:3.11.3 FROM alpine:3.11.0
RUN apk add --no-cache \ RUN apk add --no-cache \
bash \ bash \

View File

@@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2020 Shohei Ueda (peaceiris) Copyright (c) 2019 Shohei Ueda (peaceiris)
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

145
README.md
View File

@@ -3,8 +3,6 @@
[![GitHub release date](https://img.shields.io/github/release-date/peaceiris/actions-gh-pages.svg)](https://github.com/peaceiris/actions-gh-pages/releases) [![GitHub release date](https://img.shields.io/github/release-date/peaceiris/actions-gh-pages.svg)](https://github.com/peaceiris/actions-gh-pages/releases)
![GitHub Actions status](https://github.com/peaceiris/actions-gh-pages/workflows/docker%20image%20ci/badge.svg) ![GitHub Actions status](https://github.com/peaceiris/actions-gh-pages/workflows/docker%20image%20ci/badge.svg)
[![Docker Hub Build Status](https://img.shields.io/docker/cloud/build/peaceiris/gh-pages.svg)](https://hub.docker.com/r/peaceiris/gh-pages) [![Docker Hub Build Status](https://img.shields.io/docker/cloud/build/peaceiris/gh-pages.svg)](https://hub.docker.com/r/peaceiris/gh-pages)
[![Release Feed](https://img.shields.io/badge/release-feed-yellow)](https://github.com/peaceiris/actions-gh-pages/releases.atom)
[![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=peaceiris/actions-gh-pages)](https://dependabot.com)
<img width="400" alt="GitHub Actions for deploying to GitHub Pages with Static Site Generators" src="./images/ogp.svg"> <img width="400" alt="GitHub Actions for deploying to GitHub Pages with Static Site Generators" src="./images/ogp.svg">
@@ -34,12 +32,10 @@ Three tokens are supported.
| Token | Private repo | Public repo | Protocol | Setup | | Token | Private repo | Public repo | Protocol | Setup |
|---|:---:|:---:|---|---| |---|:---:|:---:|---|---|
| `GITHUB_TOKEN` | ✅️ | (1) | HTTPS | Unnecessary | | `GITHUB_TOKEN` | ✅️ | ❌️ | HTTPS | Unnecessary |
| `PERSONAL_TOKEN` | ✅️ | ✅️ | HTTPS | Necessary | | `PERSONAL_TOKEN` | ✅️ | ✅️ | HTTPS | Necessary |
| `ACTIONS_DEPLOY_KEY` | ✅️ | ✅️ | SSH | Necessary | | `ACTIONS_DEPLOY_KEY` | ✅️ | ✅️ | SSH | Necessary |
1. Currently, GitHub Actions does not support to trigger a GitHub Pages build event using GITHUB_TOKEN on a public repository.
Do you want to skip the docker build step? OK, the script mode is available. Do you want to skip the docker build step? OK, the script mode is available.
```yaml ```yaml
@@ -75,9 +71,6 @@ Do you want to skip the docker build step? OK, the script mode is available.
- [⭐️ Keeping existing files](#%EF%B8%8F-keeping-existing-files) - [⭐️ Keeping existing files](#%EF%B8%8F-keeping-existing-files)
- [⭐️ Deploy to external repository](#%EF%B8%8F-deploy-to-external-repository) - [⭐️ Deploy to external repository](#%EF%B8%8F-deploy-to-external-repository)
- [⭐️ Force orphan](#%EF%B8%8F-force-orphan) - [⭐️ Force orphan](#%EF%B8%8F-force-orphan)
- [⭐️ Set Git username and email](#%EF%B8%8F-set-git-username-and-email)
- [⭐️ Set custom commit message](#%EF%B8%8F-set-custom-commit-message)
- [⭐️ Create Git tag](#%EF%B8%8F-create-git-tag)
- [⭐️ Script mode](#%EF%B8%8F-script-mode) - [⭐️ Script mode](#%EF%B8%8F-script-mode)
- [Tips and FAQ](#tips-and-faq) - [Tips and FAQ](#tips-and-faq)
- [⭐️ Use the latest and specific release](#%EF%B8%8F-use-the-latest-and-specific-release) - [⭐️ Use the latest and specific release](#%EF%B8%8F-use-the-latest-and-specific-release)
@@ -91,7 +84,6 @@ Do you want to skip the docker build step? OK, the script mode is available.
- [⭐️ Static Site Generators with Python](#%EF%B8%8F-static-site-generators-with-python) - [⭐️ Static Site Generators with Python](#%EF%B8%8F-static-site-generators-with-python)
- [⭐️ mdBook (Rust)](#%EF%B8%8F-mdbook-rust) - [⭐️ mdBook (Rust)](#%EF%B8%8F-mdbook-rust)
- [⭐️ Flutter Web](#%EF%B8%8F-flutter-web) - [⭐️ Flutter Web](#%EF%B8%8F-flutter-web)
- [⭐️ Elm](#%EF%B8%8F-elm)
- [License](#license) - [License](#license)
- [About the author](#about-the-author) - [About the author](#about-the-author)
@@ -319,96 +311,6 @@ This allows you to make your publish branch with only the latest commit.
forceOrphan: true forceOrphan: true
``` ```
### ⭐️ Set Git username and email
Set custom `git config user.name` and `git config user.email`.
A commit is always created with the same user.
```yaml
- name: Deploy
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./public
with:
username: "iris"
useremail: "iris@peaceiris.com"
```
### ⭐️ Set custom commit message
Set custom commit message.
When we create a commit with a message `docs: Update some post`, a deployment commit will be generated with a message `docs: Update some post ${GITHUB_SHA}`.
```yaml
- name: Deploy
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./public
with:
commitMessage: ${{ github.event.head_commit.message }}
```
### ⭐️ Create Git tag
Here is an example workflow.
```yaml
name: github pages
on:
push:
branches:
- master
tags:
- 'v*.*.*'
jobs:
build-deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Some build
- name: Prepare tag
id: prepare_tag
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG_NAME="${GITHUB_REF##refs/tags/}"
echo "::set-output name=tag_name::${TAG_NAME}"
echo "::set-output name=deploy_tag_name::deploy-${TAG_NAME}"
- name: Deploy
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./public
with:
tagName: ${{ steps.prepare_tag.outputs.deploy_tag_name }}
tagMessage: 'Deployment ${{ steps.prepare_tag.outputs.tag_name }}'
```
Commands on a local machine.
```console
$ # On the master branch
$ git tag -a "v1.2.3" -m "Release v1.2.3"
$ git push origin "v1.2.3"
$ # After deployment
$ git fetch origin
$ git tag
deploy-v1.2.3 # Tag on the gh-pages branch
v1.2.3 # Tag on the master branch
```
We can set `tagOverwrite` option to `true` for overwriting a tag.
### ⭐️ Script mode ### ⭐️ Script mode
From `v2.5.0`, we can run this action as a shell script. From `v2.5.0`, we can run this action as a shell script.
@@ -809,12 +711,9 @@ jobs:
An exapmle workflow for [Flutter web project]. An exapmle workflow for [Flutter web project].
Setup [Flutter] with [subosito/flutter-action]. Setup [Flutter] with [subosito/flutter-action].
[peanut | Dart Package] is also useful.
[Flutter]: https://github.com/flutter/flutter [Flutter]: https://github.com/flutter/flutter
[Flutter web project]: https://flutter.dev/docs/get-started/web [Flutter web project]: https://flutter.dev/docs/get-started/web
[subosito/flutter-action]: https://github.com/subosito/flutter-action [subosito/flutter-action]: https://github.com/subosito/flutter-action
[peanut | Dart Package]: https://pub.dev/packages/peanut
```yaml ```yaml
name: github pages name: github pages
@@ -851,48 +750,6 @@ jobs:
PUBLISH_DIR: ./build/web PUBLISH_DIR: ./build/web
``` ```
### ⭐️ Elm
An exapmle workflow for [Elm] with [justgook/setup-elm].
[Elm]: https://elm-lang.org
[justgook/setup-elm]: https://github.com/justgook/setup-elm
```yaml
name: github pages
on:
push:
branches:
- master
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Elm
uses: justgook/setup-elm@v1
- name: Make
run: elm make --optimize src/Main.elm
- name: Move files
run: |
mkdir ./public
mv ./index.html ./public/
# If you have non-minimal setup with some assets and separate html/js files,
# provide --output=<output-file> option for `elm make` and remove this step
- name: Deploy
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./public
```
## License ## License
- [MIT License - peaceiris/actions-gh-pages] - [MIT License - peaceiris/actions-gh-pages]

View File

@@ -20,22 +20,3 @@ inputs:
description: 'Keep only the latest commit on a GitHub Pages branch' description: 'Keep only the latest commit on a GitHub Pages branch'
required: false required: false
default: 'false' default: 'false'
username:
description: 'Set Git user.name'
required: false
useremail:
description: 'Set Git user.email'
required: false
commitMessage:
description: 'Set custom commit message'
required: false
tagName:
description: 'Set tag name'
required: false
tagMessage:
description: 'Set tag message'
required: false
tagOverwrite:
description: 'Enable overwriting tag'
required: false
default: false

View File

@@ -53,7 +53,7 @@ elif [ -n "${GITHUB_TOKEN}" ]; then
print_error "GITHUB_TOKEN works only private repo, See #9" print_error "GITHUB_TOKEN works only private repo, See #9"
if [ -n "${EXTERNAL_REPOSITORY}" ]; then if [ -n "${EXTERNAL_REPOSITORY}" ]; then
print_error "can not use GITHUB_TOKEN to deploy to an external repository" print_error "can not use GITHUB_TOKEN to deploy to a external repository"
exit 1 exit 1
fi fi
@@ -102,34 +102,14 @@ else
fi fi
# push to publishing branch # push to publishing branch
if [[ -n "${INPUT_USERNAME}" ]]; then git config user.name "${GITHUB_ACTOR}"
git config --global user.name "${INPUT_USERNAME}" git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
else
git config --global user.name "${GITHUB_ACTOR}"
fi
if [[ -n "${INPUT_USEREMAIL}" ]]; then
git config --global user.email "${INPUT_USEREMAIL}"
else
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
fi
git remote rm origin || true git remote rm origin || true
git remote add origin "${remote_repo}" git remote add origin "${remote_repo}"
git add --all git add --all
print_info "Allowing empty commits: ${INPUT_EMPTYCOMMITS}" print_info "Allowing empty commits: ${INPUT_EMPTYCOMMITS}"
COMMIT_MESSAGE="Automated deployment: $(date -u) ${GITHUB_SHA}"
if [ -n "${INPUT_COMMITMESSAGE}" ]; then
BASE_COMMIT_MESSAGE="${INPUT_COMMITMESSAGE}"
else
BASE_COMMIT_MESSAGE="Automated deployment: $(date -u)"
fi
if [ -n "${EXTERNAL_REPOSITORY}" ]; then
COMMIT_MESSAGE="${BASE_COMMIT_MESSAGE} ${GITHUB_REPOSITORY}@${GITHUB_SHA}"
else
COMMIT_MESSAGE="${BASE_COMMIT_MESSAGE} ${GITHUB_SHA}"
fi
if [[ ${INPUT_EMPTYCOMMITS} == "false" ]]; then if [[ ${INPUT_EMPTYCOMMITS} == "false" ]]; then
git commit -m "${COMMIT_MESSAGE}" || skip git commit -m "${COMMIT_MESSAGE}" || skip
else else
@@ -142,22 +122,4 @@ else
git push origin "${remote_branch}" git push origin "${remote_branch}"
fi fi
if [[ -n "${INPUT_TAGNAME}" ]]; then
print_info "Tag name: ${INPUT_TAGNAME}"
print_info "Tag message: ${INPUT_TAGMESSAGE}"
print_info "Tag overwrite: ${INPUT_TAGOVERWRITE}"
if [[ -n "${INPUT_TAGMESSAGE}" ]]; then
GIT_TAG_MESSAGE="${INPUT_TAGMESSAGE}"
else
GIT_TAG_MESSAGE="Deployment ${INPUT_TAGNAME}"
fi
if [[ "${INPUT_TAGOVERWRITE}" == "true" ]]; then
GIT_TAG_OPTION="--force"
else
GIT_TAG_OPTION=""
fi
git tag "${GIT_TAG_OPTION}" -a "${INPUT_TAGNAME}" -m "${GIT_TAG_MESSAGE}"
git push "${GIT_TAG_OPTION}" origin "${INPUT_TAGNAME}"
fi
print_info "${GITHUB_SHA} was successfully deployed" print_info "${GITHUB_SHA} was successfully deployed"

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 46 KiB