Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
ku1ik committed Nov 14, 2024
2 parents f712afd + 09f442f commit 73a5b5f
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 11 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ jobs:
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
IMAGE_TAG="${{ github.ref_name }}"
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
[[ "${{ github.ref_type }}" == "tag" ]] && IMAGE_TAG=$(echo $IMAGE_TAG | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
[ "$IMAGE_TAG" == "main" ] && IMAGE_TAG=latest
VERSION="${{ github.sha }}"
[[ "${{ github.ref_type }}" == "tag" ]] && VERSION="${{ github.ref_name }}"
[[ "${{ github.ref_type }}" == "branch" ]] && VERSION="${{ github.ref_name }}-${{ github.sha }}"
echo IMAGE_ID=$IMAGE_ID >> $GITHUB_OUTPUT
echo IMAGE_TAG=$IMAGE_TAG >> $GITHUB_OUTPUT
echo VERSION=$VERSION >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
Expand All @@ -50,8 +53,10 @@ jobs:
with:
context: .
push: true
tags: ${{ steps.vars.outputs.IMAGE_ID }}:${{ steps.vars.outputs.VERSION }}
tags: ${{ steps.vars.outputs.IMAGE_ID }}:${{ steps.vars.outputs.IMAGE_TAG }}
labels: runnumber=${{ github.run_id }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
build-args: |
VERSION=${{ steps.vars.outputs.VERSION }}
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ARG ELIXIR_VERSION=1.14.3
# https://github.com/hexpm/bob#docker-images
FROM docker.io/hexpm/elixir:${ELIXIR_VERSION}-erlang-${ERLANG_OTP_VERSION}-alpine-${ALPINE_VERSION} as builder

ARG VERSION
ARG MIX_ENV=prod
ENV ERL_FLAGS="+JPperf true"
# Avoid "error 137" (out of memory) while building images
Expand Down
2 changes: 2 additions & 0 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
# General application configuration
import Config

config :asciinema, version: System.get_env("VERSION")

config :asciinema, :session_opts,
store: :cookie,
key: "_asciinema_key",
Expand Down
4 changes: 3 additions & 1 deletion lib/asciinema_web/controllers/page_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ defmodule AsciinemaWeb.PageController do
conn,
"about.html",
page_title: "About",
contact_email_address: Application.get_env(:asciinema, :contact_email_address)
contact_email_address: Application.get_env(:asciinema, :contact_email_address),
server_name: AsciinemaWeb.Endpoint.host(),
server_version: Application.get_env(:asciinema, :version)
)
end

Expand Down
15 changes: 11 additions & 4 deletions lib/asciinema_web/controllers/page_html/about.html.heex
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
<h1>About <%= @conn.host %></h1>
<h1>About <%= @server_name %></h1>

<p>
<strong><%= @conn.host %></strong> is a platform for hosting and sharing
terminal session recordings, powered by <a href="https://docs.asciinema.org/manual/server/">asciinema server</a>.
<strong><%= @server_name %></strong>
is a platform for hosting and sharing
terminal session recordings, powered by
<%= if @server_version do %>
<a href="https://docs.asciinema.org/manual/server/">asciinema server</a>
(<%= @server_version %>).
<% else %>
<a href="https://docs.asciinema.org/manual/server/">asciinema server</a>.
<% end %>
</p>

<%= if @contact_email_address do %>
Expand All @@ -22,7 +29,7 @@
<li>account access problems,</li>
<li>recording recovery,</li>
<li>content reporting,</li>
<li>security vulnerability, which may affect <%= @conn.host %> users.</li>
<li>security vulnerability, which may affect <%= @server_name %> users.</li>
</ul>

<p>
Expand Down
2 changes: 1 addition & 1 deletion lib/asciinema_web/controllers/username_html/new.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<br />

<p>
Every asciinema user gets a profile page at <a href="#"><%= url(~p"/") %>/~<strong>username</strong></a>.
Every asciinema user gets a profile page at <a href="#"><%= url(~p"/") %>~<strong>username</strong></a>.
</p>

<.form :let={f} for={@changeset} action={~p"/username"} class="username-form" method="post">
Expand Down

0 comments on commit 73a5b5f

Please sign in to comment.