mirror of
https://github.com/fawazahmed0/exchange-api.git
synced 2025-06-30 02:31:14 +00:00
63 lines
1.9 KiB
YAML
63 lines
1.9 KiB
YAML
name: Publish-Currencies
|
|
|
|
# Controls when the action will run. Triggers the workflow on push or pull request
|
|
# events but only for branch 1 and on start directory, command.txt file changes or by manually running the workflow from actions tab
|
|
on:
|
|
schedule:
|
|
- cron: '0 0 * * *' # every day at midnight
|
|
|
|
workflow_dispatch:
|
|
|
|
env: # Or as an environment variable
|
|
currlink: ${{ secrets.CURRLINK }}
|
|
currlink2: ${{ secrets.CURRLINK2 }}
|
|
currlink3: ${{ secrets.CURRLINK3 }}
|
|
currlink3key: ${{ secrets.CURRLINK3KEY }}
|
|
cryptolink: ${{ secrets.CRYPTOLINK }}
|
|
|
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
|
jobs:
|
|
# This workflow contains a single job called "build"
|
|
build:
|
|
# The type of runner that the job will run on
|
|
runs-on: ubuntu-latest
|
|
|
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '21.6.2'
|
|
registry-url: 'https://registry.npmjs.org'
|
|
|
|
- name: Install Dependencies
|
|
run: |
|
|
sudo apt-get update -y
|
|
sudo apt-get install swapspace -y
|
|
npm i
|
|
npx playwright install --with-deps
|
|
|
|
- name: Running the command
|
|
run: node currscript.js
|
|
|
|
- name: Rerun the command if previous failed
|
|
if: failure()
|
|
run: node currscript.js
|
|
|
|
|
|
- name: Deploy to cloudflare
|
|
uses: cloudflare/wrangler-action@v3
|
|
with:
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
command: |
|
|
pages deploy --project-name=currency-api --branch=`date -I` package
|
|
|
|
|
|
# - name: unpublish older version
|
|
# run: npm unpublish @fawazahmed0/currency-api@`date -d "94 days ago" -I | tr '-' '.'`
|
|
# env:
|
|
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|