retrospring/.github/workflows/build-image.yml
dependabot[bot] c631987488
Bump actions/checkout from 4.2.1 to 4.2.2
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.1 to 4.2.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4.2.1...v4.2.2)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-28 09:03:08 +00:00

58 lines
1.7 KiB
YAML

---
name: Build container image
on:
workflow_dispatch:
push:
branches: [ main ]
tags: [ '*' ]
pull_request:
paths:
- .github/workflows/build-image.yml
- Containerfile
jobs:
build-image:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4.2.2
- name: Discover build-time variables
run: |
echo "RUBY_VERSION=$(cat .ruby-version)" >> $GITHUB_ENV
echo "BUNDLER_VERSION=$(egrep -A1 "^BUNDLED WITH" Gemfile.lock | tr -d '\n' | awk '{ print $3; }')" >> $GITHUB_ENV
case "${{ github.ref_name }}" in
*/merge)
# use commit id as version for pull requests
echo "RETROSPRING_VERSION=${{ github.sha }}" >> $GITHUB_ENV
;;
*)
# use tags and branches as version otherwise
echo "RETROSPRING_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
;;
esac
- name: Login to registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name != 'pull_request'
- name: Build and push
uses: docker/build-push-action@v6
with:
build-args: |
BUNDLER_VERSION=${{ env.BUNDLER_VERSION }}
RETROSPRING_VERSION=${{ env.RETROSPRING_VERSION }}
RUBY_VERSION=${{ env.RUBY_VERSION }}
context: .
file: Containerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/retrospring/retrospring:${{ env.RETROSPRING_VERSION }}