submodules.... #10
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: Publish Docker image | |
# on: | |
# release: | |
# types: [published] | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
push_to_registry: | |
name: Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# with: | |
# submodules: true | |
- name: rewrite ssh to https | |
run: | | |
git config --global url.https://github.com/.insteadOf "[email protected]/" | |
git config --global url.https://github.com/.insteadOf "[email protected]:" | |
git config --global url.https://github.com/.insteadOf "ssh://[email protected]:" | |
git config --global url.https://gitlab.com/.insteadOf "[email protected]/" | |
git config --global url.https://gitlab.com/.insteadOf "[email protected]:" | |
git config --global url.https://gitlab.com/.insteadOf "ssh://[email protected]:" | |
# echo '[url "https://github.com/"]' >> ~/.gitconfig | |
# echo ' insteadOf = ssh://[email protected]/' >> ~/.gitconfig | |
# echo ' insteadOf = [email protected]:' >> ~/.gitconfig | |
# echo '[url "https://gitlab.com/"]' >> ~/.gitconfig | |
# echo ' insteadOf = ssh://[email protected]/' >> ~/.gitconfig | |
# echo ' insteadOf = [email protected]:' >> ~/.gitconfig | |
- name: submodule checkout | |
run: | | |
ssh-keygen -t rsa -b 4096 -m PEM -f gh-actions-key -q -N "" | |
# Start the SSH agent and add the key | |
eval "$(ssh-agent -s)" | |
ssh-add gh-actions-key | |
# Ensure SSH does not ask for host verification | |
mkdir -p ~/.ssh | |
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config | |
ssh-keyscan -t rsa gitlab.com >> ~/.ssh/known_hosts | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
git submodule sync --recursive | |
git submodule update --init --recursive | |
# git submodule update --init | |
- name: 'Login to GitHub Container Registry' | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{github.actor}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
- name: 'Build and push Image' | |
run: | | |
./docker-build-and-run.sh "--build-only" | |
docker save maxhbr/ldbcollector:latest | gzip > ldbcollector_latest.tar.gz | |
docker tag "maxhbr/ldbcollector" "ghcr.io/maxhbr/ldbcollector:latest" | |
docker push "ghcr.io/maxhbr/ldbcollector:latest" | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: dockerimage | |
path: ldbcollector_latest.tar.gz |