+komentoj #120
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: procezujo voko-araneo | |
# https://github.com/actions/starter-workflows/blob/master/ci/docker-push.yml | |
# SOLVENDA: ni bezonas la eldonon de voko-grundo respondan al la aktuala eldono de voko-araneo (docker pull...) | |
# momente ni uzas la etikedon de la branĉo, ekz-e v2d -> :2d sed tio ne funkcias por la ĉefa branĉo (master) | |
# pli bone estus enrigardi en iun dosieron (Dockerfile, eldono.sh a.s.) por eltrovi la ĝustan eldonon | |
# aŭ uzi la eldono-skripton por aŭtomate sinkronigi la eldonon en ĉiuj dosieroj docker.push, Dockerfile ktp. per | |
# la komandoj en eldono.sh, t.e. sed///; | |
on: | |
push: | |
# Publish `master` as Docker `latest` image. | |
branches: | |
- master | |
# Publish `v1.2.3` tags as releases. | |
tags: | |
- v* | |
# Run tests for any PRs. | |
pull_request: | |
env: | |
# image name. | |
IMAGE_NAME: voko-araneo | |
IMAGE_ENTRY: araneo | |
# IMAGE_TEST: med-medio | |
ORGANIZATION: revuloj | |
jobs: | |
# Run tests. | |
# See also https://docs.docker.com/docker-hub/builds/automated-testing/ | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
# https://github.com/actions/checkout | |
- name: checkout | |
uses: actions/checkout@v4 | |
# - name: Run tests | |
# run: | | |
# if [ -f docker-compose.test.yml ]; then | |
# docker-compose --file docker-compose.test.yml build | |
# docker-compose --file docker-compose.test.yml run sut | |
# else | |
# docker build . --file Dockerfile | |
# fi | |
# - name: testoj | |
# run: | | |
# docker build . --file Dockerfile --tag $IMAGE_NAME | |
# docker run $IMAGE_NAME $IMAGE_ENTRY med-medio | |
# docker run $IMAGE_NAME $IMAGE_ENTRY inx-? | |
# docker run $IMAGE_NAME $IMAGE_ENTRY tez-? | |
- name: Kreo de ${{ env.IMAGE_NAME }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# ne plu necesa por legi: echo $GITHUB_TOKEN | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin | |
# tio akiras voko-grundo kaj kompilas la procezujon voko-araneo | |
./sbin/eldono kreo | |
- name: Testoj de ${{ env.IMAGE_NAME }} | |
run: | | |
tst/docker-test.sh $IMAGE_NAME | |
- name: Arĥivo de ${{ env.IMAGE_NAME }} | |
run: | | |
docker image save -o ${IMAGE_NAME}.tar ${IMAGE_NAME} | |
# https://github.com/actions/upload-artifact | |
- name: Konservo de ${{ env.IMAGE_NAME }} por la sekvonta tasko | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.IMAGE_NAME }} | |
path: ${{ env.IMAGE_NAME }}.tar | |
# Push image to GitHub Package Registry. | |
# See also https://docs.docker.com/docker-hub/builds/ | |
push: | |
# Ensure test job passes before pushing image. | |
needs: test | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
steps: | |
# https://github.com/actions/download-artifact | |
- name: Reakiro de ${{ env.IMAGE_NAME }} | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.IMAGE_NAME }} | |
path: image | |
- name: Saluto al ghcr.io | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo $GITHUB_TOKEN | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin | |
- name: Push image | |
run: | | |
docker image load -i image/${IMAGE_NAME}.tar | |
# ĉu eblus ankau nur /revuloj/ ($ORGANIZATION) ? | |
IMAGE_ID=ghcr.io/${{ github.repository }}/$IMAGE_NAME | |
# Strip git ref prefix from version | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
# Use Docker `latest` tag convention | |
[ "$VERSION" == "master" ] && VERSION=latest | |
echo IMAGE_ID=$IMAGE_ID | |
echo VERSION=$VERSION | |
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | |
docker push $IMAGE_ID:$VERSION |