Add container publishing and env-based runtime
This commit is contained in:
@@ -23,3 +23,33 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
run: go build .
|
||||
|
||||
publish:
|
||||
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/main'
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Docker CLI
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y docker.io
|
||||
|
||||
- name: Login to Gitea Registry
|
||||
env:
|
||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
run: |
|
||||
registry_host="${GITHUB_SERVER_URL#http://}"
|
||||
registry_host="${registry_host#https://}"
|
||||
printf '%s' "${REGISTRY_PASSWORD}" | docker login "${registry_host}" -u "${GITHUB_REPOSITORY_OWNER}" --password-stdin
|
||||
|
||||
- name: Build and Push Image
|
||||
run: |
|
||||
registry_host="${GITHUB_SERVER_URL#http://}"
|
||||
registry_host="${registry_host#https://}"
|
||||
image="${registry_host}/${GITHUB_REPOSITORY}"
|
||||
docker build -t "${image}:main" -t "${image}:sha-${GITHUB_SHA}" .
|
||||
docker push "${image}:main"
|
||||
docker push "${image}:sha-${GITHUB_SHA}"
|
||||
|
||||
Reference in New Issue
Block a user