Skip to content

Commit

Permalink
bump to v0.18.1.0
Browse files Browse the repository at this point in the history
- add VERSION file to track intented target
- update build script to use VERSION
- update github workflow to use VERSION
  • Loading branch information
cornfeedhobo committed Aug 14, 2022
1 parent ab4647b commit aeb6f4e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 28 deletions.
34 changes: 11 additions & 23 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Checkout ${{ github.repository }}
uses: actions/checkout@v3

- name: Collect build context
id: context
run: |
echo "::set-output name=date::$(date +'%Y-%m-%d')"
echo "::set-output name=version::$(cat VERSION)"
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
Expand All @@ -26,35 +35,14 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

- name: Collect build context
id: context
run: |
echo "::set-output name=date::$(date +'%Y-%m-%d')"
if ${{ github.ref_name == 'master' }}; then
echo "::set-output name=url::latest"
else
echo "::set-output name=url::tags/${{ github.ref_name }}"
fi
- name: Get monero release metadata
id: get_release_meta
uses: octokit/[email protected]
with:
route: GET /repos/monero-project/monero/releases/${{ steps.context.outputs.url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get monero tag ref
id: get_release_ref
uses: octokit/[email protected]
with:
route: GET /repos/monero-project/monero/git/refs/tags/${{ fromJson(steps.get_release_meta.outputs.data).tag_name }}
route: GET /repos/monero-project/monero/git/refs/tags/${{ steps.context.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout ${{ github.repository }}
uses: actions/checkout@v3

- name: Docker metadata mapping
id: meta
uses: docker/metadata-action@v4
Expand All @@ -77,6 +65,6 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
build-args: |
BUILD_DATE=${{ steps.context.outputs.date }}
MONERO_VERSION=${{ fromJson(steps.get_release_meta.outputs.data).tag_name }}
MONERO_VERSION=${{ steps.context.outputs.version }}
MONERO_HASH=${{ fromJson(steps.get_release_ref.outputs.data).object.sha }}
MONERO_TARGET=release
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ ARG MONERO_VERSION
ARG MONERO_HASH
ARG MONERO_TARGET

RUN set -ex && \
test -n "${MONERO_HASH}" && \
test -n "${MONERO_TARGET}" && \
test -n "${MONERO_VERSION}"

# These steps are broken up so that the builder picks up the layer from the --update command
RUN set -ex && apk --update --no-cache upgrade
RUN set -ex && apk add --no-cache \
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v0.18.1.0
10 changes: 5 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ if [ -n "${DEBUG:-}" ]; then
fi

repo='monero-project/monero'
tag="$(git rev-parse --abbrev-ref HEAD)"
tag="$(< VERSION)"
sha="$(curl -LSs "https://api.github.com/repos/${repo}/git/ref/tags/${tag}" | jq -r '.object.sha')"

build_flags="${1:-}"
build_date="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
build_script="$(sed -e "s/[[:space:]]\+/ /g" <<-ENDSCRIPT
docker build ${build_flags} \
--build-arg "BUILD_DATE=${build_date}" \
--build-arg "MONERO_VERSION=${tag}" \
--build-arg "MONERO_HASH=${sha}" \
--build-arg "MONERO_TARGET=release" \
--build-arg BUILD_DATE=${build_date} \
--build-arg MONERO_VERSION=${tag} \
--build-arg MONERO_HASH=${sha} \
--build-arg MONERO_TARGET=release \
-t cornfeedhobo/monero:${tag} .
ENDSCRIPT
)"
Expand Down

0 comments on commit aeb6f4e

Please sign in to comment.