Skip to content

Commit

Permalink
Merge pull request #1132 from maddeezy/master
Browse files Browse the repository at this point in the history
Updates build-and-deploy.yml
  • Loading branch information
maddeezy authored Mar 4, 2024
2 parents e9512e7 + 53bb987 commit f75b4ee
Show file tree
Hide file tree
Showing 8 changed files with 3,658 additions and 2,572 deletions.
108 changes: 74 additions & 34 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,88 @@
# Sample workflow for building and deploying a Next.js site to GitHub Pages
#
# To get started with Next.js see: https://nextjs.org/docs/getting-started
#
name: Deploy Next.js site to Pages

on:
# Runs on pushes targeting the default branch
push:
pull_request:
branches:
- master
branches: ["master"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Update apt repos
run: sudo apt-get update

- name: Set the correct Node version using nvm
shell: bash -l {0}
run: nvm install

- name: Install yarn
shell: bash -l {0}
run: curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - && echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list && sudo apt-get update && sudo apt-get install yarn

- name: use yarn to install dependencies
shell: bash -l {0}
run: yarn install

- name: Git Setup Global Config
shell: bash -l {0}
run: export GITHUB_USER=justinvforvendetta && echo "GITHUB_USER=$GITHUB_USER" >> $GITHUB_ENV && echo "GITHUB_TOKEN=${{ secrets.JUSTINVFORVENDETTA }}" >> $GITHUB_ENV && git config --global user.email "[email protected]" && git config --global user.name $GITHUB_USER

- name: yarn install and deploy
shell: bash -l {0}
run: export GITHUB_USER=justinvforvendetta && echo "GITHUB_USER=$GITHUB_USER" >> $GITHUB_ENV && echo "GITHUB_TOKEN=${{ secrets.JUSTINVFORVENDETTA }}" >> $GITHUB_ENV && git config --global user.email "[email protected]" && git config --global user.name justinvforvendetta && git remote set-url origin https://$GITHUB_USER:${{ secrets.JUSTINVFORVENDETTA }}@github.com/vergecurrency/vergecurrency.com.git && npm install -g gh-pages --save-dev && gh-pages -t true -m 'Github Actions automated build' -d docs && yarn run deploy

- name: Upload site
uses: actions/upload-artifact@v3
- name: Checkout
uses: actions/checkout@v4
- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=yarn" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/package.json" ]; then
echo "manager=npm" >> $GITHUB_OUTPUT
echo "command=ci" >> $GITHUB_OUTPUT
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
exit 0
else
echo "Unable to determine package manager"
exit 1
fi
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "18"
cache: ${{ steps.detect-package-manager.outputs.manager }}
- name: Setup Pages
uses: actions/configure-pages@v4
with:
# Automatically inject basePath in your Next.js configuration file and disable
# server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
#
# You may remove this line if you want to manage the configuration yourself.
static_site_generator: next
- name: Restore cache
uses: actions/cache@v4
with:
name: vergecurrency.com
path: |
./src/*.js
.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
- name: Install dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
- name: Build with Next.js
run: ${{ steps.detect-package-manager.outputs.runner }} next build
- name: Static HTML export with Next.js
run: ${{ steps.detect-package-manager.outputs.runner }} next export
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./out

# Deployment job
deploy:
environment:
name: github-pages
Expand All @@ -52,4 +92,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3
uses: actions/deploy-pages@v4
95 changes: 0 additions & 95 deletions .github/workflows/nextjs.yml

This file was deleted.

17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

14 changes: 8 additions & 6 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ const paths = {
dist: 'docs',
};

gulp.task('serve', () => (
gulp.src(paths.dist)
.pipe(webserver({
function serve() {
return gulp.src(paths.dist).pipe(
webserver({
port: 3001,
}))
));
})
);
}

gulp.task('default', ['serve']);
exports.serve = serve;
exports.default = gulp.series(serve);
8 changes: 7 additions & 1 deletion lists/exchanges.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
"img": "../static/img/exchanges/bitmart.svg",
"title": "BitMart",
"link": "bitmart.com",
"url": "https://www.bitmart.com"
"url": "https://www.bitmart.com/register-referral/en?r=Vkvp3T"
},
{
"img": "../static/img/exchanges/coinw.svg",
"title": "CoinW",
"link": "coinw.com",
"url": "https://www.coinw.com/h5/invitePublicity?r=256518"
},
{
"img": "../static/img/exchanges/swapswop.png",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"gh-pages": "^1.1.0",
"glob": "^7.1.4",
"glob-all": "^3.1.0",
"gulp": "^3.9.1",
"gulp": "4.0.2",
"gulp-webserver": "^0.9.1",
"i18next": "^10.3.0",
"i18next-browser-languagedetector": "^2.1.0",
Expand Down
68 changes: 68 additions & 0 deletions static/img/exchanges/coinw.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit f75b4ee

Please sign in to comment.