soaska is building new image 🚀 #1
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: Actions Build Docker Image | |
run-name: ${{ github.actor }} is building new image 🚀 | |
on: [push] | |
jobs: | |
Explore-github-Actions: | |
runs-on: alpine | |
steps: | |
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." | |
- name: Install Node.js | |
run: | | |
apk add --no-cache nodejs | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: List files in the repository | |
run: | | |
ls ${{ github.workspace }} | |
- run: echo "🍏 This job's status is ${{ job.status }}." | |
- name: Install Docker | |
run: | | |
apk add --no-cache docker | |
- name: Start Docker service | |
run: | | |
dockerd & | |
sleep 5 | |
docker info | |
- name: Build Dockerfile | |
run: | | |
docker build -t sd_telegram . | |
- name: Add new variables | |
run: | | |
package_name=$(basename ${{ github.repository }}) | |
commit_date=$(git log -1 --format=%cd --date=format:'%Y%m%d%H%M%S') | |
echo "package_name=$package_name, commit_date=$commit_date" | |
- name: Upload Docker image to ghcr.io | |
run: | | |
package_name=$(basename ${{ github.repository }}) | |
commit_date=$(git log -1 --format=%cd --date=format:'%Y%m%d%H%M%S') | |
docker login -u ${{ secrets.username }} -p ${{ secrets.password }} ghcr.io | |
docker tag sd_telegram ghcr.io/${{ secrets.username }}/$package_name:$commit_date | |
docker tag sd_telegram ghcr.io/${{ secrets.username }}/$package_name:latest | |
docker push ghcr.io/${{ secrets.username }}/$package_name:$commit_date | |
docker push ghcr.io/${{ secrets.username }}/$package_name:latest |