Deploy #5826
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: Deploy | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
# Run every 4 hours | |
- cron: "0 */4 * * *" | |
jobs: | |
worker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Publish | |
uses: cloudflare/wrangler-action@2.0.0 | |
with: | |
apiToken: ${{ secrets.CF_API_TOKEN }} | |
workingDirectory: "worker" | |
web: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./vue | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: install node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16" | |
- name: build | |
run: npm install && npm run build | |
- name: deploy | |
uses: w9jds/firebase-action@master | |
with: | |
args: deploy --only hosting | |
env: | |
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} | |
PROJECT_PATH: ./vue | |
server: | |
permissions: | |
contents: "read" | |
id-token: "write" | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./express | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: build | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "14" | |
- name: install node deps | |
run: npm install --only=production | |
- name: env file | |
run: | | |
touch .env | |
echo COOKIE_SECRET=${{ secrets.COOKIE_SECRET }} >> .env | |
echo TWITTER_CONSUMER_KEY=${{ secrets.TWITTER_CONSUMER_KEY }} >> .env | |
echo TWITTER_CONSUMER_SECRET=${{ secrets.TWITTER_CONSUMER_SECRET }} >> .env | |
echo AUTO_TWT_CONSUMER_KEY=${{ secrets.AUTO_TWT_CONSUMER_KEY }} >> .env | |
echo AUTO_TWT_CONSUMER_SECRET=${{ secrets.AUTO_TWT_CONSUMER_SECRET }} >> .env | |
echo AUTO_TWT_ACCESS_TOKEN=${{ secrets.AUTO_TWT_ACCESS_TOKEN }} >> .env | |
echo AUTO_TWT_ACCESS_SECRET=${{ secrets.AUTO_TWT_ACCESS_SECRET }} >> .env | |
echo GH_CLIENT_ID=${{ secrets.GH_CLIENT_ID }} >> .env | |
echo GH_CLIENT_SECRET=${{ secrets.GH_CLIENT_SECRET }} >> .env | |
echo GOOG_CLIENT_ID=${{ secrets.GOOG_CLIENT_ID }} >> .env | |
echo GOOG_CLIENT_SECRET=${{ secrets.GOOG_CLIENT_SECRET }} >> .env | |
echo YOUTUBE_API_KEY=${{ secrets.YOUTUBE_API_KEY }} >> .env | |
cat .env | |
- name: gcp auth | |
uses: "google-github-actions/auth@v2" | |
with: | |
credentials_json: "${{ secrets.GCP_CREDENTIALS }}" | |
- name: gcloud cli install | |
uses: "google-github-actions/setup-gcloud@v2" | |
- name: prepare data dir | |
run: mkdir ./data | |
- name: build index | |
run: npm run reindex | |
- name: deploy | |
run: "gcloud functions deploy api --trigger-http --runtime nodejs16 --memory=1024MB --timeout=1m --project=dev-tube --no-gen2" |