Publish official image #17
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 official image | |
on: | |
workflow_dispatch: | |
env: | |
bashbrew-version: 0.1.12 | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
environment: docker-official | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: monica-docker | |
persist-credentials: false | |
- uses: actions/checkout@v4 | |
with: | |
repository: docker-library/official-images | |
fetch-depth: 0 | |
path: official-images | |
persist-credentials: false | |
- name: Install bashbrew | |
working-directory: monica-docker | |
run: | | |
curl -fsSL -o bashbrew https://github.com/docker-library/bashbrew/releases/download/v${{ env.bashbrew-version }}/bashbrew-amd64 | |
chmod +x "bashbrew" | |
- name: Run stackbrew | |
working-directory: monica-docker | |
run: | | |
./generate-stackbrew-library.sh | tee ../official-images/library/monica | |
- name: Update | |
working-directory: official-images | |
run: | | |
remote=upstream | |
remoteurl="https://$USER_NAME:[email protected]/$USER_NAME/official-images.git" | |
latest="$(curl -fsSL 'https://api.github.com/repos/monicahq/monica/releases/latest' | jq -r '.tag_name' | cut -c 2-)" | |
branch="monica-v$latest" | |
message="Update Monica to v$latest" | |
status=$(git status --porcelain) | |
if [ -n "$status" ]; then | |
git status | |
git add library/monica | |
git config user.email $USER_EMAIL | |
git config user.name $USER_NAME | |
git checkout -b $branch | |
git commit -m "$message" | |
git remote remove $remote || true | |
git remote add -f $remote "$remoteurl" || true | |
git push --set-upstream $remote $branch | |
gh pr create --repo docker-library/official-images --title "$message" --body "Update Monica to [v$latest](https://github.com/monicahq/monica/releases/tag/v$latest)." | |
else | |
echo "Already up to date" | |
fi | |
env: | |
USER_EMAIL: ${{ secrets.USER_EMAIL }} | |
USER_NAME: ${{ secrets.USER_NAME }} | |
GH_TOKEN: ${{ secrets.PUSH_GITHUB_TOKEN }} |