This repository has been archived by the owner on Sep 27, 2023. It is now read-only.
update-code #188
Workflow file for this run
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: update-code | |
on: | |
schedule: | |
- cron: '42 0 * * 1' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
with: | |
fetch-depth: 1 | |
- name: Fetch latest code | |
run: make update | |
- name: Verify mixed environment still runs | |
timeout-minutes: 10 | |
run: | | |
sudo echo "127.0.0.1 node1 node2 node3 node4" | sudo tee -a /etc/hosts | |
make verify_latest | |
- name: Set git credentials | |
uses: oleksiyrudenko/gha-git-credentials@v2 | |
with: | |
token: '${{ secrets.GITHUB_TOKEN }}' | |
- name: Update github repo | |
run: | | |
if [ "${GITHUB_REF##*/}" = "master" ]; then | |
git add . | |
if [ "$(git status --porcelain)" ]; then | |
echo "REPLAY=true" >> $GITHUB_ENV | |
echo "PUSH=true" >> $GITHUB_ENV | |
fi | |
else | |
echo "REPLAY=true" >> $GITHUB_ENV | |
fi | |
echo "REPLAY: ${{ env.REPLAY }}" | |
echo "PUSH: ${{ env.PUSH }}" | |
# - name: Replay | |
# if: env.REPLAY == 'true' | |
# run: | | |
# ( cd upstream/cothority; go build -o ../../bcadmin ./byzcoin/bcadmin ) | |
# wget --progress=dot:giga https://demo.c4dt.org/omniledger/cached.db | |
# if [ "${GITHUB_REF##*/}" != master ]; then export BLOCKS="--blocks 256"; fi | |
# ./bcadmin --debug 1 db replay cached.db --summarize 100 $BLOCKS 9cc36071ccb902a1de7e0d21a2c176d73894b1cf88ae4cc2ba4c95cd76f474f3 | |
- name: Push | |
if: env.PUSH == 'true' | |
run: | | |
git commit -am "Automatic update on $( date )" | |
git push | |
- name: Set docker credentials | |
uses: crazy-max/ghaction-docker-login@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Push new docker image | |
run: make docker-push-new | |
- name: Store linux binaries | |
uses: actions/upload-artifact@v2 | |
with: | |
name: linux-binary | |
path: docker | |
release: | |
runs-on: macos-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@master | |
with: | |
fetch-depth: 1 | |
# - name: Compile Mac binaries | |
# run: | | |
# MAC=macosx | |
# mkdir -p $MAC | |
# for bin in byzcoin full; do go build -o $MAC ./cmd/$bin; done | |
# ( cd pkg/cothority; \ | |
# for bin in byzcoin/bcadmin scmgr personhood/phapp; do \ | |
# go build -o ../../$MAC ./$bin; \ | |
# done ) | |
- name: Fetch linux binaries | |
uses: actions/download-artifact@v2 | |
with: | |
name: linux-binary | |
path: linux | |
- name: show | |
run: ls -R | |
- name: Create release.tgz | |
run: | | |
RELEASE_DATE=$(date +%Y-%m-%d) | |
RELEASE=byzcoin-$RELEASE_DATE | |
mkdir $RELEASE | |
ls -l | |
( cd linux; rm -f Dockerfile built byzcoin.sh ) | |
#mv linux macosx $RELEASE | |
mv linux $RELEASE | |
ls -R $RELEASE | |
tar czf byzcoin-linux-$RELEASE_DATE.tgz $RELEASE | |
#tar czf byzcoin-linux-macosx-$RELEASE_DATE.tgz $RELEASE | |
echo "RELEASE_DATE=$RELEASE_DATE" >> $GITHUB_ENV | |
- name: Create release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "*.tgz" | |
body: "Binary release of the byzcoin files" | |
#name: "Release linux and macOSX ${{env.RELEASE_DATE}}" | |
name: "Release linux ${{env.RELEASE_DATE}}" | |
prerelease: false | |
tag: release-${{env.RELEASE_DATE}} | |
token: ${{ secrets.GITHUB_TOKEN }} |