feat: move build-publish github actions to docker/build-push-action@v2

* feat: first upgrade attempt

* fix: user and pass

* feat: try hirosystems image

* feat: install cmake, push standalone

* fix: use correct standalone tags

* fix: try re-adding sha and ref tags

* chore: sort dependencies

* chore: version fixes

* fix: only run for master,develop branches
This commit is contained in:
Rafael Cárdenas
2021-12-06 10:02:24 -06:00
committed by GitHub
parent f18068c300
commit 352a054b71
3 changed files with 50 additions and 19 deletions

View File

@@ -3,7 +3,8 @@ name: stacks-blockchain-api
on:
push:
branches:
- '**'
- master
- develop
tags-ignore:
- '**'
paths-ignore:
@@ -426,14 +427,19 @@ jobs:
build-publish:
runs-on: ubuntu-latest
needs:
- test
- test-rosetta
- lint
- lint-docs
- test
- test-bns
- test-rosetta
- test-rosetta-cli-construction
- test-rosetta-cli-data
- test-tokens
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2.5.0
@@ -452,28 +458,52 @@ jobs:
semantic-release-slack-bot
@semantic-release/exec
- name: Build/Tag/Push Image
uses: docker/build-push-action@v1
- name: Docker Meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
blockstack/${{ github.workflow }}
hirosystems/${{ github.workflow }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Docker Standalone Meta
id: meta_standalone
uses: docker/metadata-action@v3
with:
images: |
blockstack/${{ github.workflow }}-standalone
hirosystems/${{ github.workflow }}-standalone
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Login to DockerHub
uses: docker/login-action@v1
with:
repository: blockstack/${{ github.workflow }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
tags: ${{ steps.semantic.outputs.new_release_version }}
tag_with_ref: true
add_git_labels: true
- name: Build/Tag/Push Image
uses: docker/build-push-action@v2
with:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# Only push if (there's a new release on main branch, or if building a non-main branch) and (Only run on non-PR events or only PRs that aren't from forks)
push: ${{ (github.ref != 'refs/heads/master' || steps.semantic.outputs.new_release_version != '') && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
- name: Build/Tag/Push standalone Image
uses: docker/build-push-action@v1
- name: Build/Tag/Push Standalone Image
uses: docker/build-push-action@v2
with:
dockerfile: docker/stx-rosetta.Dockerfile
repository: blockstack/${{ github.workflow }}-standalone
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
tags: ${{ steps.semantic.outputs.new_release_version }}
tag_with_ref: true
add_git_labels: true
file: docker/stx-rosetta.Dockerfile
tags: ${{ steps.meta_standalone.outputs.tags }}
labels: ${{ steps.meta_standalone.outputs.labels }}
# Only push if (there's a new release on main branch, or if building a non-main branch) and (Only run on non-PR events or only PRs that aren't from forks)
push: ${{ (github.ref != 'refs/heads/master' || steps.semantic.outputs.new_release_version != '') && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}

View File

@@ -3,7 +3,7 @@ FROM node:14-alpine
WORKDIR /app
COPY . .
RUN apk add --no-cache --virtual .build-deps alpine-sdk python2 git openjdk8-jre
RUN apk add --no-cache --virtual .build-deps alpine-sdk python3 git openjdk8-jre cmake
RUN echo "GIT_TAG=$(git tag --points-at HEAD)" >> .env
RUN npm config set unsafe-perm true && npm install && npm run build && npm prune --production
RUN apk del .build-deps

View File

@@ -29,6 +29,7 @@ RUN apt-get update -y \
curl \
jq \
openjdk-11-jre-headless \
cmake \
&& git clone -b ${STACKS_API_VERSION} --depth 1 https://github.com/${STACKS_API_REPO} . \
&& echo "GIT_TAG=$(git tag --points-at HEAD)" >> .env \
&& npm config set unsafe-perm true \