Skip to content

Add docker image

Add docker image #11

Workflow file for this run

name: frp-port-keeper-ci
on:
workflow_dispatch:
push:
paths-ignore:
- './*.md'
tags:
- 'v[0-9]+.[0-9]+.*'
branches:
- master
pull_request:
branches:
- master
env:
DOCKER_USERNAME: ${{ vars.GHCR_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.GHCR_TOKEN }}
FORCE_COLOR: 1
jobs:
# TODO: Add test job
# test:
validate_pr:
permissions:
contents: read
packages: read
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Put back the git branch into git (Earthly uses it for tagging)
run: |
branch=""
if [ -n "$GITHUB_HEAD_REF" ]; then
branch="$GITHUB_HEAD_REF"
else
branch="${GITHUB_REF##*/}"
fi
git checkout -b "$branch" || true
- name: Download Earthly
run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.7.8/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'"
- name: Validate PR
run: |
earthly --ci +validate-pr
release:
permissions:
contents: write
# needs: test
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Put back the git branch into git (Earthly uses it for tagging)
run: |
branch=""
if [ -n "$GITHUB_HEAD_REF" ]; then
branch="$GITHUB_HEAD_REF"
else
branch="${GITHUB_REF##*/}"
fi
git checkout -b "$branch" || true
- name: Download Earthly
run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.7.8/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'"
- name: Build and create release
run: |
earthly --ci +release \
--RELEASE_VERSION=${GITHUB_REF:10} \
--GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
- name: Put back the git branch into git (Earthly uses it for tagging)
run: |
branch=""
if [ -n "$GITHUB_HEAD_REF" ]; then
branch="$GITHUB_HEAD_REF"
else
branch="${GITHUB_REF##*/}"
fi
git checkout -b "$branch" || true
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${DOCKER_USERNAME}
password: ${DOCKER_PASSWORD}
- name: Build and push docker image
run: |
earthly --ci --push +image \
--TARGET_DOCKER_REGISTRY=ghcr.io/librepod \
--RELEASE_VERSION=${{ github.ref_name }}