Skip to content

Commit

Permalink
build onetime ,seprate edit by sed :release
Browse files Browse the repository at this point in the history
  • Loading branch information
foxundermoon committed Jan 28, 2020
1 parent 14634b8 commit a83cb3d
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions .github/workflows/auto_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
runs-on: ubuntu-latest
env:
OUT_DIR: ./packages/transparent-info-app/out
IPNS: /ipns/Qmd3HzpnpSsLeUQF2mJEXn24a1yYo2LTaQyoq4mwxkse1Z
steps:
- name: check prerelease
if: endsWith(github.event.head_commit.message,':prerelease')
Expand Down Expand Up @@ -41,6 +42,8 @@ jobs:
node-version: 12.x
- name: build and export
if: env.NEED_RELEASE == 'yes'
env:
ASSETS_PREFIX: ${{ env.IPNS }}
run: |
echo "::set-env name=VERSION::$(cat lerna.json|jq -r .version)"
yarn
Expand All @@ -52,25 +55,19 @@ jobs:
run: |
wget https://github.com/ipfs/go-ipfs/releases/download/v0.4.22/go-ipfs_v0.4.22_linux-amd64.tar.gz
tar -xf ./go-ipfs_v0.4.22_linux-amd64.tar.gz
- name: add assets to ipfs
- name: add to ipfs
run: |
dir="${{ env.OUT_DIR }}"
find $dir ! -path $dir |egrep -v _next |xargs rm -rf
./go-ipfs/ipfs --api=/dns4/ncov.fox.mn/tcp/5001 add -r $dir |tee -a assets_rst.log
IPFS_CID=$(cat ./assets_rst.log | tail -n 1 | awk '{print $2}')
echo "::set-env name=ASSETS_IPFS_CID::${IPFS_CID}"
- name: rebuild with assets prefix
env:
ASSETS_PREFIX: /ipfs/${{ env.ASSETS_IPFS_CID }}
run: |
yarn run build
yarn run export
rm -rf "${{ env.OUT_DIR }}/_next"
- name: add html file to ipfs
run: |
dir="${{ env.OUT_DIR }}"
./go-ipfs/ipfs --api=/dns4/ncov.fox.mn/tcp/5001 add -r $dir |tee -a rst.log
cp -r $dir ./out_bak1
cp -r $dir ./out_bak2
find ./out_bak1 ! -path ./out_bak1 |egrep -v _next |xargs rm -rf
./go-ipfs/ipfs --api=/dns4/ncov.fox.mn/tcp/5001 add -r $dir --hidden |tee -a assets_rst.log
ASSETS_IPFS_CID=$(cat ./assets_rst.log | tail -n 1 | awk '{print $2}')
echo "::set-env name=ASSETS_IPFS_CID::${ASSETS_IPFS_CID}"
rm -rf ./out_bak2/_next
find ./out_bak2/ -type file |xargs -I ^_^ sed -i -e "s|${{ env.IPNS }}|/ipfs/${ASSETS_IPFS_CID}|g" ^_^
./go-ipfs/ipfs --api=/dns4/ncov.fox.mn/tcp/5001 add -r ./out_bak2 --hidden |tee -a rst.log
IPFS_CID=$(cat ./rst.log | tail -n 1 | awk '{print $2}')
echo "::set-env name=IPFS_CID::${IPFS_CID}"
Expand Down

0 comments on commit a83cb3d

Please sign in to comment.