Add docker image #15
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
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: ${{ vars.GHCR_USERNAME }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Build and push docker image | |
run: | | |
earthly --ci --push +image \ | |
--TARGET_DOCKER_REGISTRY=ghcr.io/librepod \ | |
--RELEASE_VERSION=${{ github.ref_name }} |