Last active
September 27, 2020 12:16
-
-
Save anzfactory/a879cdf14dbbe6d336007f062b50b890 to your computer and use it in GitHub Desktop.
Swift製の静的サイトジェネレーター「Publish」でビルドしつつ、Firebase HostingにデプロイするGitHub Actionsのワークフロー
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Fix Swift version | |
run: | | |
cd $HOME | |
wget https://swift.org/builds/swift-5.2.5-release/ubuntu1804/swift-5.2.5-RELEASE/swift-5.2.5-RELEASE-ubuntu18.04.tar.gz | |
tar xzvf swift-5.2.5-RELEASE-ubuntu18.04.tar.gz | |
echo "::add-path::$HOME/swift-5.2.5-RELEASE-ubuntu18.04/usr/bin" | |
- name: Setup Publish | |
run: | | |
cd $HOME | |
git clone --depth=1 https://github.com/JohnSundell/Publish.git | |
cd ./Publish | |
swift build -c release | |
echo "::add-path::${HOME}/Publish/.build/release" | |
- name: Build blog | |
run: | | |
cd $GITHUB_WORKSPACE | |
publish-cli generate | |
mv ./Output/404/index.html ./Output/404.html | |
rmdir ./Output/404/ | |
- name: Install firebase-tools | |
run: | | |
mkdir ${HOME}/.npm-global | |
npm config set prefix ${HOME}/.npm-global | |
echo "::add-path::${HOME}/.npm-global/bin" | |
npm install -g [email protected] | |
- name: Deploy blog | |
run: firebase deploy --only hosting --token $FIREBASE_TOKEN | |
env: | |
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} |
swift 5.3 だと Publish の generate がコケるので swift 5.2 で固定する。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://blog.anzfactory.xyz/articles/20200923/github-actions-build-publish-deploy-firebase-hosting/