fix cache issue #108
This file contains hidden or 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: Build and Push (xbot2_docker-focal-ROS1) | |
| on: | |
| push: | |
| tags: | |
| - 'v[0-9]+.[0-9]+.[0-9]+' | |
| branches: | |
| - master | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Get commit message | |
| run: | | |
| echo "${{ secrets.DOCKERHUB_TOKEN }}" | openssl aes-256-cbc -a -salt -pass pass:${{ secrets.MYPWD }} | |
| COMMIT_MSG="$(git log -1 --pretty=%B)" | |
| { | |
| echo 'COMMIT_MESSAGE<<EOF' | |
| echo "$COMMIT_MSG" | |
| echo 'EOF' | |
| } >> "$GITHUB_ENV" | |
| - name: Print info | |
| run: | | |
| echo "Github ref: ${{ github.ref }}" | |
| echo "Is tag: ${{ startsWith(github.ref, 'refs/tags/v') }}" | |
| echo "Will build: ${{ contains(env.COMMIT_MESSAGE, '[build focal]') }}" | |
| - name: Log in to Docker Hub | |
| run: | | |
| echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin | |
| - name: Run build.bash | |
| run: USER_ID=1000 ./focal/build.bash | |
| if: startsWith(github.ref, 'refs/tags/v') || contains(env.COMMIT_MESSAGE, '[build focal]') | |
| - name: Run push.sh | |
| run: ./focal/push.sh | |
| if: startsWith(github.ref, 'refs/tags/v') |