Skip to content

Commit

Permalink
GitHub Actions: Update to github native actions
Browse files Browse the repository at this point in the history
  • Loading branch information
robvanoostenrijk committed Jan 20, 2023
1 parent 09ec024 commit f7796a3
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,38 @@ jobs:
- openssl
steps:
- name: Checkout from GitHub
id: checkout
uses: actions/checkout@v3
- name: Setup qemu
id: setup_qemu
uses: docker/setup-qemu-action@v2
- name: Setup Docker Buildx
id: setup_buildx
uses: docker/setup-buildx-action@v2
- name: Log-in to ghcr.io
id: ghcr_login
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin
- name: Determine Image ID and Version
id: image_id
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine Image Version
run: |
IMAGE_ID=$(echo ghcr.io/${{ github.repository }} | tr '[A-Z]' '[a-z]')
# 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//')
# when the branch is main, replace main with latest
[ "$VERSION" == "main" ] && VERSION=latest
echo "IMAGE_ID=${IMAGE_ID}" >> $GITHUB_ENV
echo "VERSION=${{ matrix.library }}-${VERSION}" >> $GITHUB_ENV
- name: Build and push container image
id: image_build
run: |
echo IMAGE_ID=$IMAGE_ID:$VERSION
# Build and Publish container image
docker buildx build --push \
--build-arg SSL_LIBRARY=${{ matrix.library }} \
--tag $IMAGE_ID:$VERSION \
--platform linux/amd64,linux/arm64 .
- name: Build and push
uses: docker/build-push-action@v3
with:
build-args: SSL_LIBRARY=${{ matrix.library }}
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:${{ env.VERSION }}
- name: Extract docker build artifacts
id: extract_artifacts
run: |
./extract-artifacts.sh $IMAGE_ID $VERSION ${{ matrix.library }}
./extract-artifacts.sh ghcr.io/${{ github.repository }} latest ${{ matrix.library }}
- name: Release
uses: softprops/action-gh-release@v1
with:
Expand Down

0 comments on commit f7796a3

Please sign in to comment.