mirror of
https://github.com/mastodon/mastodon
synced 2024-11-30 15:58:14 +09:00
Change the pre-release versioning scheme and associated environment variables (#26653)
This commit is contained in:
parent
072112867b
commit
f39847476c
6
.github/workflows/build-container-image.yml
vendored
6
.github/workflows/build-container-image.yml
vendored
@ -8,7 +8,9 @@ on:
|
||||
type: boolean
|
||||
push_to_images:
|
||||
type: string
|
||||
version_suffix:
|
||||
version_prerelease:
|
||||
type: string
|
||||
version_metadata:
|
||||
type: string
|
||||
flavor:
|
||||
type: string
|
||||
@ -83,7 +85,7 @@ jobs:
|
||||
- uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
build-args: MASTODON_VERSION_SUFFIX=${{ inputs.version_suffix }}
|
||||
build-args: MASTODON_VERSION_PRERELEASE=${{ inputs.version_prerelease }} MASTODON_VERSION_METADATA=${{ inputs.version_metadata }}
|
||||
platforms: ${{ inputs.platforms }}
|
||||
provenance: false
|
||||
builder: ${{ steps.buildx.outputs.name || steps.buildx-native.outputs.name }}
|
||||
|
9
.github/workflows/build-nightly.yml
vendored
9
.github/workflows/build-nightly.yml
vendored
@ -16,9 +16,9 @@ jobs:
|
||||
env:
|
||||
TZ: Etc/UTC
|
||||
run: |
|
||||
echo mastodon_version_suffix=nightly.$(date +'%Y-%m-%d')>> $GITHUB_OUTPUT
|
||||
echo mastodon_version_prerelease=nightly.$(date +'%Y-%m-%d')>> $GITHUB_OUTPUT
|
||||
outputs:
|
||||
suffix: ${{ steps.version_vars.outputs.mastodon_version_suffix }}
|
||||
prerelease: ${{ steps.version_vars.outputs.mastodon_version_prerelease }}
|
||||
|
||||
build-image:
|
||||
needs: compute-suffix
|
||||
@ -29,8 +29,7 @@ jobs:
|
||||
push_to_images: |
|
||||
tootsuite/mastodon
|
||||
ghcr.io/mastodon/mastodon
|
||||
# The `-` is important here, result will be v4.1.2-nightly.2022-03-05
|
||||
version_suffix: -${{ needs.compute-suffix.outputs.suffix }}
|
||||
version_prerelease: ${{ needs.compute-suffix.outputs.prerelease }}
|
||||
labels: |
|
||||
org.opencontainers.image.description=Nightly build image used for testing purposes
|
||||
flavor: |
|
||||
@ -38,5 +37,5 @@ jobs:
|
||||
tags: |
|
||||
type=raw,value=edge
|
||||
type=raw,value=nightly
|
||||
type=schedule,pattern=${{ needs.compute-suffix.outputs.suffix }}
|
||||
type=schedule,pattern=${{ needs.compute-suffix.outputs.prerelease }}
|
||||
secrets: inherit
|
||||
|
6
.github/workflows/build-push-pr.yml
vendored
6
.github/workflows/build-push-pr.yml
vendored
@ -21,9 +21,9 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
- id: version_vars
|
||||
run: |
|
||||
echo mastodon_version_suffix=+pr-${{ github.event.pull_request.number }}-$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT
|
||||
echo mastodon_version_metadata=pr-${{ github.event.pull_request.number }}-$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT
|
||||
outputs:
|
||||
suffix: ${{ steps.version_vars.outputs.mastodon_version_suffix }}
|
||||
metadata: ${{ steps.version_vars.outputs.mastodon_version_metadata }}
|
||||
|
||||
build-image:
|
||||
needs: compute-suffix
|
||||
@ -33,7 +33,7 @@ jobs:
|
||||
use_native_arm64_builder: true
|
||||
push_to_images: |
|
||||
ghcr.io/mastodon/mastodon
|
||||
version_suffix: ${{ needs.compute-suffix.outputs.suffix }}
|
||||
version_metadata: ${{ needs.compute-suffix.outputs.metadata }}
|
||||
flavor: |
|
||||
latest=auto
|
||||
tags: |
|
||||
|
@ -42,8 +42,8 @@ RUN apt-get update && \
|
||||
FROM node:${NODE_VERSION}
|
||||
|
||||
# Use those args to specify your own version flags & suffixes
|
||||
ARG MASTODON_VERSION_FLAGS=""
|
||||
ARG MASTODON_VERSION_SUFFIX=""
|
||||
ARG MASTODON_VERSION_PRERELEASE=""
|
||||
ARG MASTODON_VERSION_METADATA=""
|
||||
|
||||
ARG UID="991"
|
||||
ARG GID="991"
|
||||
@ -89,8 +89,8 @@ ENV RAILS_ENV="production" \
|
||||
NODE_ENV="production" \
|
||||
RAILS_SERVE_STATIC_FILES="true" \
|
||||
BIND="0.0.0.0" \
|
||||
MASTODON_VERSION_FLAGS="${MASTODON_VERSION_FLAGS}" \
|
||||
MASTODON_VERSION_SUFFIX="${MASTODON_VERSION_SUFFIX}"
|
||||
MASTODON_VERSION_PRERELEASE="${MASTODON_VERSION_PRERELEASE}" \
|
||||
MASTODON_VERSION_METADATA="${MASTODON_VERSION_METADATA}"
|
||||
|
||||
# Set the run user
|
||||
USER mastodon
|
||||
|
@ -16,12 +16,16 @@ module Mastodon
|
||||
0
|
||||
end
|
||||
|
||||
def flags
|
||||
ENV['MASTODON_VERSION_FLAGS'].presence || '-beta2'
|
||||
def default_prerelease
|
||||
'beta2'
|
||||
end
|
||||
|
||||
def suffix
|
||||
ENV.fetch('MASTODON_VERSION_SUFFIX', '')
|
||||
def prerelease
|
||||
ENV['MASTODON_VERSION_PRERELEASE'].presence || default_prerelease
|
||||
end
|
||||
|
||||
def build_metadata
|
||||
ENV.fetch('MASTODON_VERSION_METADATA', nil)
|
||||
end
|
||||
|
||||
def to_a
|
||||
@ -29,7 +33,10 @@ module Mastodon
|
||||
end
|
||||
|
||||
def to_s
|
||||
[to_a.join('.'), flags, suffix].join
|
||||
components = [to_a.join('.')]
|
||||
components << "-#{prerelease}" if prerelease.present?
|
||||
components << "+#{build_metadata}" if build_metadata.present?
|
||||
components.join
|
||||
end
|
||||
|
||||
def repository
|
||||
|
Loading…
Reference in New Issue
Block a user